Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
pmint93 committed May 9, 2023
1 parent 2111365 commit d64e8b7
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions otelfiber/fiber.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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...)
Expand Down

0 comments on commit d64e8b7

Please sign in to comment.