Class OpenTelemetryClientPropagatorTransportWrapper
java.lang.Object
org.a2aproject.sdk.extras.opentelemetry.client.propagation.OpenTelemetryClientPropagatorTransportWrapper
- All Implemented Interfaces:
Comparable<ClientTransportWrapper>, ClientTransportWrapper
public class OpenTelemetryClientPropagatorTransportWrapper
extends Object
implements ClientTransportWrapper
OpenTelemetry client transport wrapper that injects W3C Trace Context headers into outbound A2A client requests.
This wrapper is automatically discovered via Java's ServiceLoader mechanism.
To enable context propagation, add an OpenTelemetry instance to the transport configuration:
ClientTransportConfig config = new JSONRPCTransportConfig();
config.setParameters(Map.of(
OpenTelemetryClientPropagatorTransportWrapper.OTEL_OPEN_TELEMETRY_KEY,
openTelemetry
));
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringConfiguration key for theOpenTelemetryinstance used for context propagation. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintpriority()Returns the priority of this wrapper.wrap(ClientTransport transport, ClientTransportConfig<?> config) Wraps the given transport with additional functionality.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ClientTransportWrapper
compareTo
-
Field Details
-
OTEL_OPEN_TELEMETRY_KEY
Configuration key for theOpenTelemetryinstance used for context propagation.- See Also:
-
-
Constructor Details
-
OpenTelemetryClientPropagatorTransportWrapper
public OpenTelemetryClientPropagatorTransportWrapper()
-
-
Method Details
-
wrap
Description copied from interface:ClientTransportWrapperWraps the given transport with additional functionality.Implementations should check the configuration to determine if they should actually wrap the transport. If the wrapper is not applicable (e.g., required configuration is missing), return the original transport unchanged.
- Specified by:
wrapin interfaceClientTransportWrapper- Parameters:
transport- the transport to wrapconfig- the transport configuration, may contain wrapper-specific parameters- Returns:
- the wrapped transport, or the original if wrapping is not applicable
-
priority
public int priority()Description copied from interface:ClientTransportWrapperReturns the priority of this wrapper. Higher priority wrappers are applied first (wrap the transport earlier, resulting in being the outermost wrapper).Default priority is 0. Suggested ranges:
- 1000+ : Critical infrastructure (security, authentication)
- 500-999: Observability (tracing, metrics, logging)
- 100-499: Enhancement (caching, retry logic)
- 0-99: Optional features
- Specified by:
priorityin interfaceClientTransportWrapper- Returns:
- the priority value, higher values = higher priority
-