-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OpenTelemetry: By default high HTTP span name cardinality for HTTP server spans #26216
Comments
/cc @radcortez |
Can you please provide a reproducer? I've tried a simple Quarkus Application with a Vert.x Router with a template path and it works as expected. We even have an integration test for it: Lines 64 to 81 in 21bd03f
I've also checked Jaeger and the names were showing correctly. This does not require the Metrics Extension to be available. The span name is only set on the span end because the route is only determined and selected after we start the span. Maybe you are running into a scenario where the span name is not being correctly updated. |
(I've updated the issue description above - see "How to reproduce".) Test concerning handling of "status 404" requests (with no explicit failure handler route getting matched):
Test concerning invalid HTTP requests Test concerning parameterized paths:
Running the
|
Thank you. I guess I've got confused by reading the title and the description which are actually 3 separate things (even if related). I've fixed the 404 span name by setting the span name to When the Micrometer extension is available, we fall back to its Metrics (including the resolution of the route name). We now force the OTel Vertx Metrics registration even if Micrometer is available and disabled. I'm just not sure if we can do something about invalid/bad requests. For instance, it is perfectly valid for the implementing application to return a 400 from an existent endpoint, and in that case, you want the span name to match the route. We do return an |
I think, you can equally say that it is valid for an application to return a 404 from an existent endpoint. Concerning the unit tests, I would expect that with a
the following test should pass:
To me it looks like the above 404 case and the 400 case can both be solved by just letting the |
We can change it to use the route if one exists even for a 404.
I guess that we can remove that code there, but just because it will be updated later when the route is actually determined by the |
For now, I won't change this, because we need it for the |
Right, the exclusion of spans for health endpoint requests would need to be handled differently, then. I wonder if it wouldn't be possible to not create these spans in the first place, instead of dropping them afterwards. In any case, regarding the handling of the invalid HTTP request spans, I've created #26776 to track this (also because there are cases for which the "matchAll" route failure handler workaround doesn't work). |
Not sure if this is possible, because Spans are handled in a very low-level API (to catch all http requests), meaning that there is no knowing if the endpoint is the health one (aside from looking into the url). |
Describe the bug
This is a follow-up of #16952.
When using the
quarkus-opentelemetry
extension and observing Vert.x HTTP server request spans, the default is still to see span names containing the full request URI path. This means you will possibly get a whole range of span names likeThe OTEL spec declares such high cardinality span names as unsuitable. In practice, this means the span selection combobox in the Jaeger UI becomes unusable.
#17676 was supposed to fix this by introducing span names with parameterized paths (e..g
/products/{productId}
), but there are quite some steps involved to fully prevent the high cardinality span names.To prevent the issue
ctx.request().routed(someName)
has to be invoked in its handler. This prevents full request URI span names for any unsupported request paths (that lead to a 404 response).quarkus-micrometer
dependency], the Vert.x HTTP server metrics have to be enabled by settingquarkus.micrometer.binder.http-server.enabled=true
.Without that, no parameterized paths get used.
Example matchAll route
Summary
FMPOV, the issue here is that
ctx.request().routed(name)
isn't invoked).quarkus-micrometer
being used and without Vert.x HTTP server metrics enabled, still the full request URI paths get used as span names for all requestsExpected behavior
I would expect the HTTP request method name (
GET
,POST
,PUT
, etc.) to be used as span name if Vert.x HTTP server metrics are not enabled and also if no request route name got set/applied (i.e. no named route got matched andctx.request().routed(name)
wasn't invoked).It seems to me, this can be implemented by just letting the
route(HttpRequest)
method inHttpInstrumenterVertxTracer.ServerAttributesExtractor
always returnnull
.Actual behavior
High cardinality span names are used by default.
How to Reproduce?
Make HTTP requests to quarkus-opentelemetry application having Vert.x HTTP server endpoint.
printf 'GET invalid HTTP/1.0\r\n\r\n' | nc -q 3 localhost 80
).Observe span names in Jaeger UI.
quarkus-micrometer
dependency and make requests to be handled by routes with parameterized paths.Observe span names.
Output of
uname -a
orver
Linux be6z00br-vm 5.4.0-117-generic #132-Ubuntu SMP Thu Jun 2 00:39:06 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
Output of
java -version
openjdk 17.0.3 2022-04-19
GraalVM version (if different from Java)
No response
Quarkus version or git rev
2.8.3
Build tool (ie. output of
mvnw --version
orgradlew --version
)No response
Additional information
No response
The text was updated successfully, but these errors were encountered: