-
Notifications
You must be signed in to change notification settings - Fork 651
otelhttp: handle request Pattern #7192
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
base: main
Are you sure you want to change the base?
Conversation
This has the downside of running the span name formatter twice if there's a pattern. |
cc @seankhliao @axw |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #7192 +/- ##
=====================================
Coverage 81.1% 81.1%
=====================================
Files 204 204
Lines 18140 18144 +4
=====================================
+ Hits 14720 14727 +7
+ Misses 3001 2999 -2
+ Partials 419 418 -1
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Neat.
One other downside of changing the name after handling the request is that it won't work well with samplers that care about the span name, like the per-operation Jaeger remote sampler, IIANM.
I can add a comment to the WithSpanNameFormatter method for better awareness of that. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a cool trick,
it may be a bit fragile if someone uses some other middleware that clones the request (uses WithContext) between otelhttp and the mux, only the new copy will have the Pattern set.
Can we have a spanformatter func or option to use the pattern (a separate pr?)
I'd make that a separate PR, yes. Do you want to open one to better articulate what you need? |
sure I can make one |
Based on top of open-telemetry#7192 Makes SpanNameFormatter a type alias for documentation. Exports the default formatters. Adds a new formatter for use with http mux patterns.
I was thinking something simple like a44c60f (currently based on top of this pr). |
Co-authored-by: Robert Pająk <[email protected]>
Co-authored-by: Robert Pająk <[email protected]>
Closes #6193
Handles otelhttp for #6919 (@Ananyasinha13 I know you're assigned this, but it has been 2 weeks with no movement).