-
Notifications
You must be signed in to change notification settings - Fork 872
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
Late bind of the Span name in SpanNameExtractor #4716
Comments
hey @radcortez!
When would this method get called (or who would call it)?
I'd personally like to keep span name updates at early as possible. In our Java agent distro, we treat the "local root" span name as the "operation name" and copy that down to the child spans, since things like "show me sql queries for /login` is a common ask, and copying the local root span name down to the child spans avoids backend indexing / joining. |
The instrumenter can call it internally, but with the current API, it can only happen when you call
To be more precise and give more detail, I've implemented a Vert.x integration using the Instrumenter API. The issue here is that on Vert.x I'm only able to discover the route name very late in the request handling (which contributes to the span name). I may be able to delay the Right now, I've worked around this with a custom |
In case of |
Exactly. My ask was to just provide a more standard way to update it. |
I think I understand, so in your case, you are able to extract the route directly from the <REQUEST, RESPONSE> that are already provided by the instrumenter? Most of the existing instrumentation requires additional instrumentation (advice) to capture the route. So this "route capturing" instrumentation calls |
Yes. Is just that I don't have it on
Yes, this could work. In essence, this is what I'm doing right now. I pass in the context in a wrapped object in <REQUEST,RESPONSE> and then I'm able to update the span name and set the route. |
Hey @radcortez , |
Thanks. Let me have a look. |
I confirm it solves the use case. Thank you! |
Is your feature request related to a problem? Please describe.
As described in #442 (comment), the
Span
provides aupdateName
method for cases when the span name is not known on the span start. In theInstrumenter
API, the span name is set via aSpanNameExtractor
at the start, and then the only way to update it is to manually retrieve theSpan
to update the name.Describe the solution you'd like
A possible solution may be to add an additional default method to
SpanNameExtractor
that allows you to implement a late bind to the span name that callsupdateName
inSpan
.Describe alternatives you've considered
Alternatively, in the
Instrumenter
implementation onend
, a second call toSpanNameExtractor#extract
could be made to update the name, but it may not be completely clear to the consumer that this is happening and could cause some undesirable side effects.I'm available to submit a PR for this.
The text was updated successfully, but these errors were encountered: