opentelemetry-go-contrib
opentelemetry-go-contrib copied to clipboard
[net/http] add http.server.active_requests metric
Follow up of https://github.com/open-telemetry/opentelemetry-go-contrib/pull/2617. As @Aneurysm9 pointed out the Labeler
can only be used after the next handler has been called. This means that for active requests it is impossible to inject attributes this way.
The committers listed above are authorized under a signed CLA.
- :white_check_mark: login: hadrienk / name: Hadrien Kohl (ed6af2314261ba8c73c9142eb025b1160fc74da4, 5783243fef7ca12df8a7ed14e4a4456f1422f669, 7fa5d03cd681daae52627ffe596e3df246c4bf75, 2d78bd21946016ac6c29f14cf9a446c51c3862e4, 4be14785c29a3357ed7797b5fde90cd2cccd64c5, ccb91274a04b3e7ce5ceb61827c9215286957935, 0262b91b3f88ceb9a99f8359b56a6732af16a89e)
- :white_check_mark: login: hanyuancheung / name: Chester Cheung (42dc8bc6df670717840e84f08766bbffd7ec1bd8)
I suppose we could add a comment somewhere about the fact that only metrics recorded after the handler is called are modifiable using a Labeler
.
➕
Please resolve the conflicts. Otherwise I cannot even run the GitHub workflows.
Tried hard to add the route tag to the active_request
but since it has to be started before the tag is injected using the Labeler
there's way to fix that without changing the API a lot.
Codecov Report
Merging #4543 (42dc8bc) into main (5ba7d1e) will increase coverage by
0.0%
. Report is 1 commits behind head on main. The diff coverage is66.6%
.
Additional details and impacted files
@@ Coverage Diff @@
## main #4543 +/- ##
=====================================
Coverage 80.8% 80.8%
=====================================
Files 150 150
Lines 10371 10361 -10
=====================================
- Hits 8387 8380 -7
+ Misses 1840 1835 -5
- Partials 144 146 +2
Files | Coverage Δ | |
---|---|---|
instrumentation/net/http/otelhttp/common.go | 100.0% <ø> (ø) |
|
instrumentation/net/http/otelhttp/handler.go | 87.4% <84.2%> (-0.4%) |
:arrow_down: |
...ion/google.golang.org/grpc/otelgrpc/interceptor.go | 88.5% <47.0%> (+0.6%) |
:arrow_up: |
Anything else you need me to do on this PR?
Tried hard to add the route tag to the
active_request
but since it has to be started before the tag is injected using theLabeler
there's way to fix that without changing the API a lot.
It is OK to not add it.
Take notice that this attribute is not specified in v1.20.0 (https://github.com/open-telemetry/opentelemetry-specification/blob/v1.20.0/specification/metrics/semantic_conventions/http-metrics.md) nor in the latest (https://opentelemetry.io/docs/specs/semconv/http/http-metrics/#metric-httpserveractive_requests)