Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ const (
// DefaultEdgeSleepInterval is the default interval after which the agent will close the tunnel if no activity.
DefaultEdgeSleepInterval = "5m"
// DefaultConfigCheckInterval is the default interval used to check if node config changed
DefaultConfigCheckInterval = "5s"
DefaultConfigCheckInterval = "300s"
// SupportedDockerAPIVersion is the minimum Docker API version supported by the agent.
SupportedDockerAPIVersion = "1.24"
// DefaultClusterProbeTimeout is the default member list ping probe timeout.
Expand Down
18 changes: 9 additions & 9 deletions edge/edge.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,15 +151,15 @@ func (manager *Manager) startEdgeBackgroundProcessOnDocker(runtimeCheckFrequency
return err
}

go func() {
ticker := time.NewTicker(runtimeCheckFrequency)
for range ticker.C {
err := manager.checkDockerRuntimeConfig()
if err != nil {
log.Printf("[ERROR] [edge] [message: an error occurred during Docker runtime configuration check] [error: %s]", err)
}
}
}()
// go func() {
// ticker := time.NewTicker(runtimeCheckFrequency)
// for range ticker.C {
// err := manager.checkDockerRuntimeConfig()
// if err != nil {
// log.Printf("[ERROR] [edge] [message: an error occurred during Docker runtime configuration check] [error: %s]", err)
// }
// }
// }()

return nil
}
Expand Down
13 changes: 13 additions & 0 deletions http/handler/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ package handler

import (
"net/http"
"net/http/pprof"
"regexp"
"runtime"
"strconv"
"strings"

Expand Down Expand Up @@ -58,6 +60,11 @@ type Config struct {
ContainerPlatform agent.ContainerPlatform
}

func init() {
runtime.SetBlockProfileRate(1)
runtime.SetMutexProfileFraction(1)
}

var dockerAPIVersionRegexp = regexp.MustCompile(`(/v[0-9]\.[0-9]*)?`)

// NewHandler returns a pointer to a Handler.
Expand Down Expand Up @@ -101,6 +108,12 @@ func (h *Handler) ServeHTTP(rw http.ResponseWriter, request *http.Request) {
rw.Header().Set(agent.HTTPResponseAgentPlatform, strconv.Itoa(int(agentPlatformIdentifier)))

switch {
case strings.HasPrefix(request.URL.Path, "/debug/pprof/profile"):
pprof.Profile(rw, request)
case strings.HasPrefix(request.URL.Path, "/debug/pprof/trace"):
pprof.Trace(rw, request)
case strings.HasPrefix(request.URL.Path, "/debug/pprof"):
pprof.Index(rw, request)
case strings.HasPrefix(request.URL.Path, "/v1"):
h.ServeHTTPV1(rw, request)
case strings.HasPrefix(request.URL.Path, "/v2"):
Expand Down