From c1d6e0d59837e7fc5084fb374786dd1f88cf5d88 Mon Sep 17 00:00:00 2001 From: Martin Gencur Date: Thu, 29 Aug 2019 04:18:43 +0200 Subject: [PATCH] Define ProfilingPort and make profiling server use it (#599) * Define ProfilingPort and make profiling server use it * Fix typ * Move ProfilingPort to server.go --- profiling/server.go | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/profiling/server.go b/profiling/server.go index 1fa3cb46f..22089ed5e 100644 --- a/profiling/server.go +++ b/profiling/server.go @@ -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, } }