Class OpenTelemetryHttpClientProducer

java.lang.Object
org.a2aproject.sdk.extras.opentelemetry.server.OpenTelemetryHttpClientProducer

@ApplicationScoped public class OpenTelemetryHttpClientProducer extends Object
CDI producer that creates an OpenTelemetryA2AHttpClient wrapping the application's HTTP client delegate with W3C trace-context propagation.

When this module is on the classpath and CDI discovers this bean, BasePushNotificationSender will use the produced @Instrumented client instead of calling A2AHttpClientFactory.create() directly, ensuring that outbound push-notification HTTP requests carry traceparent and tracestate headers.

The delegate is resolved from CDI first: if the application provides a custom unqualified A2AHttpClient bean (e.g. one configured with mTLS, a proxy, or custom timeouts), this producer wraps that bean so the application's HTTP configuration is preserved. When no CDI-provided bean exists, the delegate falls back to A2AHttpClientFactory.create(A2AHttpClientConfiguration) with the "cdi" provider excluded (to avoid the self-delegation cycle that would otherwise occur when the CDI provider re-enters the container).

The produced client is qualified with Instrumented so it does not compete with the application's own A2AHttpClient bean in default CDI resolution. BasePushNotificationSender prefers a @Instrumented client when one is available.

  • Constructor Details

    • OpenTelemetryHttpClientProducer

      protected OpenTelemetryHttpClientProducer()
    • OpenTelemetryHttpClientProducer

      @Inject public OpenTelemetryHttpClientProducer(io.opentelemetry.api.OpenTelemetry openTelemetry)