From 6516cd5c6cae39b384198b4ecf8a15e5ce545301 Mon Sep 17 00:00:00 2001 From: Mikhail Mazurskiy Date: Tue, 31 Oct 2023 22:19:18 +1100 Subject: [PATCH] otelhttp: set unit on the server latency histogram --- instrumentation/net/http/otelhttp/common.go | 2 +- instrumentation/net/http/otelhttp/handler.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/instrumentation/net/http/otelhttp/common.go b/instrumentation/net/http/otelhttp/common.go index 303e5505e41..4fa950dfe2e 100644 --- a/instrumentation/net/http/otelhttp/common.go +++ b/instrumentation/net/http/otelhttp/common.go @@ -34,7 +34,7 @@ const ( RequestCount = "http.server.request_count" // Incoming request count total RequestContentLength = "http.server.request_content_length" // Incoming request bytes total ResponseContentLength = "http.server.response_content_length" // Incoming response bytes total - ServerLatency = "http.server.duration" // Incoming end to end duration, microseconds + ServerLatency = "http.server.duration" // Incoming end to end duration, milliseconds ) // Filter is a predicate used to determine whether a given http.request should diff --git a/instrumentation/net/http/otelhttp/handler.go b/instrumentation/net/http/otelhttp/handler.go index b2fbe07841c..a174c005037 100644 --- a/instrumentation/net/http/otelhttp/handler.go +++ b/instrumentation/net/http/otelhttp/handler.go @@ -113,7 +113,7 @@ func (h *middleware) createMeasures() { responseBytesCounter, err := h.meter.Int64Counter(ResponseContentLength) handleErr(err) - serverLatencyMeasure, err := h.meter.Float64Histogram(ServerLatency) + serverLatencyMeasure, err := h.meter.Float64Histogram(ServerLatency, metric.WithUnit("ms")) handleErr(err) h.counters[RequestContentLength] = requestBytesCounter