-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
feat(tracing): dont trace spans with full request paths as operation name in ExtractFromHTTPRequest #15971
Conversation
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 is unfortunate that we don't have access to the httprouter
path associated with the handler. I just walked through some of the implementation using my debugger, and it appears that there is no way to access that path (I'm talking about /api/v2/foo/:id
not the called path).
I also don't like handlerName
because it can't be kept consistent between usage. Reflection would be a better way to fill that blank.
What do you think about adjusting ExtractFromHTTPRequest
to take routerPath
instead of handlerName
?
8368e78
to
dbbe687
Compare
dbbe687
to
cf16065
Compare
9bf3b33
to
cc09555
Compare
I tagged you in this @mark-rushakoff to review the approach of doing a hard cut-over to an |
cc09555
to
be0748b
Compare
I will come back to this. Do a full replace everywhere means updating flux to use our fork as well. |
"github.com/julienschmidt/httprouter" | ||
"github.com/influxdata/httprouter" |
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.
I thought the go.mod replace was supposed to make import changes unnecessary?
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.
Yeah as @mark-rushakoff says. This is great until the compat tests run and then it breaks :( but seems like bringing the fork under our banner works.
My latest problem is flux depends on the original version 😂 that is my next challenge. figured it out
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.
Works for me.
@jacobmarble using a replacement directive only affects the current module. Projects that import influxdb would still use the julienschmidt/httprouter
module, which means they would not be able to compile influxdb due to our httprouter fork becoming intentionally API-incompatible.
…with influxdata/httprouter
be0748b
to
f909d9e
Compare
This updates our automatic span creation from http request method in the tracing kit.
Prior to this change all request paths were being logged in spans as operation names.
This has led to many operation names (and therefore increased cardinality required).
Now we have all operations being reported as
request
along with the following tags:base_path
which is an attempt to capture import resource identifiers e.g. (/api/v2/buckets
) but not the resource identifierhandler_name
which is the handler which is called to invoke this operationIt also logs the full url path with the key
path
. This is for a little more context.My proposed change has increased the number of allocations required. So I thought I would share here for your consideration:
Update:
So I have a PR open on
httprouter
julienschmidt/httprouter#286This now vendors that change and relies on it to get the router match from the request context (this what my PR allows you to do with httprouter).
This means we don't need to do any complicated deriving of some base path. Instead we tag the spans with the router path as was desired.
e.g. a handler mounted on route
/api/v2/buckets/:bucket_id
would produce the tagroute=/api/v2/buckets/:bucket_id
.