From d64e8b70596231c3f5baa4e1253c7400a9f9490c Mon Sep 17 00:00:00 2001 From: pmint93 Date: Tue, 9 May 2023 16:28:58 +0700 Subject: [PATCH] Adapt changes in https://github.com/open-telemetry/opentelemetry-go/pull/3971 --- otelfiber/fiber.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/otelfiber/fiber.go b/otelfiber/fiber.go index 19f6e716..8e2ceba1 100644 --- a/otelfiber/fiber.go +++ b/otelfiber/fiber.go @@ -87,7 +87,8 @@ func Middleware(opts ...Option) fiber.Handler { start := time.Now() requestMetricsAttrs := httpServerMetricAttributesFromRequest(c, cfg) - httpServerActiveRequests.Add(savedCtx, 1, requestMetricsAttrs...) + + httpServerActiveRequests.Add(savedCtx, 1, instrument.AddOption{}.applyAdd(instrument.AddConfig{attrs: requestMetricsAttrs})) responseMetricAttrs := make([]attribute.KeyValue, len(requestMetricsAttrs)) copy(responseMetricAttrs, requestMetricsAttrs) @@ -136,7 +137,7 @@ func Middleware(opts ...Option) fiber.Handler { responseMetricAttrs, responseAttrs...) - httpServerActiveRequests.Add(savedCtx, -1, requestMetricsAttrs...) + httpServerActiveRequests.Add(savedCtx, -1, instrument.AddOption{}.applyAdd(instrument.AddConfig{attrs: requestMetricsAttrs})) httpServerDuration.Record(savedCtx, float64(time.Since(start).Microseconds())/1000, responseMetricAttrs...) httpServerRequestSize.Record(savedCtx, requestSize, responseMetricAttrs...) httpServerResponseSize.Record(savedCtx, responseSize, responseMetricAttrs...)