Class AwsSdkTelemetryBuilder

java.lang.Object
io.opentelemetry.instrumentation.awssdk.v2_2.AwsSdkTelemetryBuilder

public final class AwsSdkTelemetryBuilder extends Object
A builder of AwsSdkTelemetry.
  • Method Details

    • setCapturedHeaders

      @CanIgnoreReturnValue public AwsSdkTelemetryBuilder setCapturedHeaders(List<String> capturedHeaders)
      Configures the messaging headers that will be captured as span attributes.
      Parameters:
      capturedHeaders - A list of messaging header names.
    • setCaptureExperimentalSpanAttributes

      @CanIgnoreReturnValue public AwsSdkTelemetryBuilder setCaptureExperimentalSpanAttributes(boolean captureExperimentalSpanAttributes)
      Sets whether experimental attributes should be set to spans. These attributes may be changed or removed in the future, so only enable this if you know you do not require attributes filled by this instrumentation to be stable across versions
    • setUseConfiguredPropagatorForMessaging

      @CanIgnoreReturnValue public AwsSdkTelemetryBuilder setUseConfiguredPropagatorForMessaging(boolean useMessagingPropagator)
      Sets whether the TextMapPropagator configured in the provided OpenTelemetry should be used to inject into supported messaging attributes (currently only SQS; SNS may follow).

      In addition, the X-Ray propagator is always used.

      Using the messaging propagator is needed if your tracing vendor requires special tracestate entries or legacy propagation information that cannot be transported via X-Ray headers. It may also be useful if you need to directly connect spans over messaging in your tracing backend, bypassing any intermediate spans/X-Ray segments that AWS may create in the delivery process.

      This option is off by default. If enabled, on extraction the configured propagator will be preferred over X-Ray if it can extract anything.

    • setRecordIndividualHttpError

      @CanIgnoreReturnValue public AwsSdkTelemetryBuilder setRecordIndividualHttpError(boolean recordIndividualHttpError)
      Sets whether errors returned by each individual HTTP request should be recorded as events for the SDK span.

      This option is off by default. If enabled, the HTTP error code and the error message will be captured and associated with the span. This provides detailed insights into errors on a per-request basis.

    • setMessagingReceiveInstrumentationEnabled

      @CanIgnoreReturnValue public AwsSdkTelemetryBuilder setMessagingReceiveInstrumentationEnabled(boolean messagingReceiveInstrumentationEnabled)
      Set whether to capture the consumer message receive telemetry in messaging instrumentation.

      Note that this will cause the consumer side to start a new trace, with only a span link connecting it to the producer trace.

    • build

      public AwsSdkTelemetry build()
      Returns a new AwsSdkTelemetry with the settings of this AwsSdkTelemetryBuilder.