Define ProfilingPort and make profiling server use it (#599)

* Define ProfilingPort and make profiling server use it

* Fix typ

* Move ProfilingPort to server.go
This commit is contained in:
Martin Gencur 2019-08-29 04:18:43 +02:00 committed by Knative Prow Robot
parent a9136e28d4
commit c1d6e0d598
1 changed files with 6 additions and 7 deletions

View File

@ -28,11 +28,11 @@ import (
)
const (
// profilingPort is the port where we expose profiling information if profiling is enabled
profilingPort = ":8008"
// ProfilingPort specifies the port where profiling data is available when profiling is enabled
ProfilingPort = 8008
// profilingKey is the name of the key in config-observability config map that indicates whether profiling
// is enabled of disabled
// profilingKey is the name of the key in config-observability config map
// that indicates whether profiling is enabled
profilingKey = "profiling.enable"
)
@ -104,11 +104,10 @@ func (h *Handler) UpdateFromConfigMap(configMap *corev1.ConfigMap) {
}
}
// NewServer creates a new http server that exposes profiling data using the
// HTTP handler that is passed as an argument
// NewServer creates a new http server that exposes profiling data on the default profiling port
func NewServer(handler http.Handler) *http.Server {
return &http.Server{
Addr: profilingPort,
Addr: ":" + strconv.Itoa(ProfilingPort),
Handler: handler,
}
}