Class MessagingAttributesExtractor<REQUEST,RESPONSE>

java.lang.Object
io.opentelemetry.instrumentation.api.incubator.semconv.messaging.MessagingAttributesExtractor<REQUEST,RESPONSE>
All Implemented Interfaces:
io.opentelemetry.instrumentation.api.instrumenter.AttributesExtractor<REQUEST,RESPONSE>, io.opentelemetry.instrumentation.api.internal.SpanKeyProvider

public final class MessagingAttributesExtractor<REQUEST,RESPONSE> extends Object implements io.opentelemetry.instrumentation.api.instrumenter.AttributesExtractor<REQUEST,RESPONSE>, io.opentelemetry.instrumentation.api.internal.SpanKeyProvider
Extractor of messaging attributes.

This class delegates to a type-specific MessagingAttributesGetter for individual attribute extraction from request/response objects.

  • Method Details

    • create

      public static <REQUEST, RESPONSE> io.opentelemetry.instrumentation.api.instrumenter.AttributesExtractor<REQUEST,RESPONSE> create(MessagingAttributesGetter<REQUEST,RESPONSE> getter, MessageOperation operation)
      Creates the messaging attributes extractor for the given operation with default configuration.
    • builder

      public static <REQUEST, RESPONSE> MessagingAttributesExtractorBuilder<REQUEST,RESPONSE> builder(MessagingAttributesGetter<REQUEST,RESPONSE> getter, MessageOperation operation)
      Returns a new MessagingAttributesExtractorBuilder for the given operation that can be used to configure the messaging attributes extractor.
    • onStart

      public void onStart(io.opentelemetry.api.common.AttributesBuilder attributes, io.opentelemetry.context.Context parentContext, REQUEST request)
      Specified by:
      onStart in interface io.opentelemetry.instrumentation.api.instrumenter.AttributesExtractor<REQUEST,RESPONSE>
    • onEnd

      public void onEnd(io.opentelemetry.api.common.AttributesBuilder attributes, io.opentelemetry.context.Context context, REQUEST request, @Nullable RESPONSE response, @Nullable Throwable error)
      Specified by:
      onEnd in interface io.opentelemetry.instrumentation.api.instrumenter.AttributesExtractor<REQUEST,RESPONSE>
    • internalGetSpanKey

      @Nullable public io.opentelemetry.instrumentation.api.internal.SpanKey internalGetSpanKey()
      This method is internal and is hence not for public use. Its API is unstable and can change at any time.
      Specified by:
      internalGetSpanKey in interface io.opentelemetry.instrumentation.api.internal.SpanKeyProvider