Skip to content

Read data from current span before closing #12433

@EddeCCC

Description

@EddeCCC

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() or Context.current(), but I haven't been successful yet.
I also couldn't find a way to convert the current Span to a SdkSpan 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions