diff --git a/internal/servers/worker/handler.go b/internal/servers/worker/handler.go index 48e7ea6de..74ab26c4f 100644 --- a/internal/servers/worker/handler.go +++ b/internal/servers/worker/handler.go @@ -42,7 +42,7 @@ func (w *Worker) handler(props HandlerProperties) (http.Handler, error) { mux.Handle("/v1/proxy", h) genericWrappedHandler := w.wrapGenericHandler(mux, props) - metricHandler := metric.InstrumentProxyHttpHandler(genericWrappedHandler) + metricHandler := metric.InstrumentHttpHandler(genericWrappedHandler) return metricHandler, nil } diff --git a/internal/servers/worker/internal/metric/proxy_http.go b/internal/servers/worker/internal/metric/proxy_http.go index 22578ded9..58888681a 100644 --- a/internal/servers/worker/internal/metric/proxy_http.go +++ b/internal/servers/worker/internal/metric/proxy_http.go @@ -25,8 +25,7 @@ const ( ) // httpTimeUntilHeader collects measurements of how long it takes -// the boundary system to hijack an HTTP request into a websocket connection -// for the proxy worker. +// the boundary worker to write back the first header to the requester. var httpTimeUntilHeader prometheus.ObserverVec = prometheus.NewHistogramVec( prometheus.HistogramOpts{ Namespace: globals.MetricNamespace, @@ -61,10 +60,10 @@ func pathLabel(incomingPath string) string { return invalidPathValue } -// InstrumentProxyHttpHandler provides a proxy handler which measures -// time until header is returned form the server and attaches status code, -// method, and path labels for each of these measurements. -func InstrumentProxyHttpHandler(wrapped http.Handler) http.Handler { +// InstrumentHttpHandler provides a handler which measures time until header +// is written by the server and attaches status code, method, and path +// labels for the relevant measurements. +func InstrumentHttpHandler(wrapped http.Handler) http.Handler { return http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) { l := prometheus.Labels{ labelHttpPath: pathLabel(req.URL.Path), @@ -76,10 +75,10 @@ func InstrumentProxyHttpHandler(wrapped http.Handler) http.Handler { }) } -// InstrumentProxyHttpCollectors registers the proxy collectors to the default -// prometheus register and initializes them to 0 for all possible label +// InitializeHttpCollectors registers the proxy collectors to the provided +// prometheus register and initializes them to 0 for the most likely label // combinations. -func InstrumentProxyHttpCollectors(r prometheus.Registerer) { +func InitializeHttpCollectors(r prometheus.Registerer) { if r == nil { return } diff --git a/internal/servers/worker/worker.go b/internal/servers/worker/worker.go index 4ca8cd7cb..a6f54aef5 100644 --- a/internal/servers/worker/worker.go +++ b/internal/servers/worker/worker.go @@ -66,7 +66,7 @@ type Worker struct { } func New(conf *Config) (*Worker, error) { - metric.InstrumentProxyHttpCollectors(conf.PrometheusRegisterer) + metric.InitializeHttpCollectors(conf.PrometheusRegisterer) w := &Worker{ conf: conf, logger: conf.Logger.Named("worker"),