Http1xServerConnection doesn't set the Vert.x context when recording metrics
ahus1 opened this issue · 4 comments
Version
4.5.10 (relevant code seems to be unchanged in main)
Context
As part of Keycloak 26, I'm running Quarkus 3.15.1 which include Vert.x 4.5.10. When I enable Quarkus Metrics and OpenTelemetry, I expect Exemplars to be recorded. Unfortunately that doesn't happen, as Http1xServerConnection
doesn't set the context, and OpentelemetryExemplarSamplerProvider
expects it to be set.
Do you have a reproducer?
https://github.com/ahus1/quarkus-otel-missing-examplar-example
Steps to reproduce
- Start Keycloak 26.0.0 and enable Metrics and OpenTelementry
- Login to issue some HTTP requests
- Retrieve metrics from the metrics endpoint using CURL
Extra
Running on JDK 17 on Windows. Seems be independent of JDK version and Windows.
In a locally patched version, I was able to fix it by updating
to wrap the calls for metrics in request.context.dispatch()
.
I'll prepare a draft PR to discuss this. As this is named Http1x
, I suspect there might be other code for HTTP/2.0
Added a reproducer: https://github.com/ahus1/quarkus-otel-missing-examplar-example
Thank you @ahus1
I added a comment in quarkusio/quarkus#43845 explaining how to retrieve the context when a tracing or metrics SPI method is invoked. For performance reasons, not all these methods are invoked on a Vert.x context (it would cost too much to reschedule the task).
I'd like to hear from Quarkus experts about Metrics / Tracing integration
Closing as it will be handled on the Quarkus side. Sorry for the noise!
No worries !