Skip to content

Commit

Permalink
otelhttp: set unit on the server latency histogram
Browse files Browse the repository at this point in the history
  • Loading branch information
ash2k committed Oct 31, 2023
1 parent bead7e4 commit 6516cd5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion instrumentation/net/http/otelhttp/common.go
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion instrumentation/net/http/otelhttp/handler.go
Expand Up @@ -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
Expand Down

0 comments on commit 6516cd5

Please sign in to comment.