-
Notifications
You must be signed in to change notification settings - Fork 881
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
Read data from current span before closing #12433
Comments
hi @EddeCCC, inside of a Java agent extension I think you can cast |
Hi @trask,
However, when I call the method, I get an
We have a quite complex set-up, where we inject an interface method Do you think, you can help me here? My last idea would be, to use reflection. Regards |
The reflection approach worked for me:
@trask If you might know a more "clean" approach, I would be happy to know about it. Otherwise, we can close this :) |
Currently extension classes are loaded in a child loader of the agent class loader. As the package private |
Greetings,
is it somehow possible to read data, like name or attributes, of the current
Span
before it's closed?I tried to get the data with
Span.current()
orContext.current()
, but I haven't been successful yet.I also couldn't find a way to convert the current
Span
to aSdkSpan
object.Background:
We are developing an OTel agent extension, which should also create spans for specific methods.
However, before we start our own span for the method, we would like to check, if there is already a span recording this method, so we don't record it twice. This could happen for example because the method is part of the agent's zero code instrumentation or the method is annotated with @WithSpan.
Since the spans we want to read are not created by ourselves, I don't believe we can work with custom SpanProcessors or Samplers, because we can't change the SDK used by the agent itself.
I would be very grateful for any help or advice.
Best Regards
The text was updated successfully, but these errors were encountered: