Skip to content

[Feat]: Propagate open telemetry context to agent execution for consolidated tracing #698

@vietk

Description

@vietk

Is your feature request related to a problem? Please describe.

Hello,

A2A Java SDK supports server OpenTelemetry thanks to OpenTelemetryRequestHandlerDecorator.
So far I managed to see sendMessage span in the traces in Tempo when I use sendMessage to my a2a application which is nice.
However, if I had my own custom span in an agent execution of my AgentExecutor, the whole trace is not consolidated with server span, it's 2 independent traces.
The main reason is that the server handling is executed inside a Vert.x router but the agent execution is done using a specific ExecutorService backed by A2A Internal executor.
Then, when the server handoff the execution to the agent executor, the opentelemetry context is not propagated and then is lost.
It results of having two different traces with their own spans and they are not linked at all.

  • The server span in a trace (provided by a2a)
  • My custom span in a trace

I would expect a single trace formed of two spans

Describe the solution you'd like

Opentelemetry context MUST be propagated between threads to ensure well formed traces with a valid parent span and the whole trace.
Since opentelemetry feature is not part of the server common modules, it's possible to define a SPI to implement for context propagation and implement it from the opentelemetry extra modules.

Describe alternatives you've considered

No response

Additional context

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions