Class HttpClientServicePeerAttributesExtractor<REQUEST,RESPONSE>

java.lang.Object
io.opentelemetry.instrumentation.api.incubator.semconv.http.HttpClientServicePeerAttributesExtractor<REQUEST,RESPONSE>
All Implemented Interfaces:
io.opentelemetry.instrumentation.api.instrumenter.AttributesExtractor<REQUEST,RESPONSE>

public final class HttpClientServicePeerAttributesExtractor<REQUEST,RESPONSE> extends Object implements io.opentelemetry.instrumentation.api.instrumenter.AttributesExtractor<REQUEST,RESPONSE>
Extractor of the service.peer.name span attribute, described in the specification.
  • Method Summary

    Modifier and Type
    Method
    Description
    static <REQUEST, RESPONSE>
    io.opentelemetry.instrumentation.api.instrumenter.AttributesExtractor<REQUEST,RESPONSE>
    create(io.opentelemetry.instrumentation.api.semconv.http.HttpClientAttributesGetter<REQUEST,RESPONSE> attributesGetter, io.opentelemetry.api.OpenTelemetry openTelemetry)
    Returns a new HttpClientServicePeerAttributesExtractor that will use the passed attributesGetter to extract server address and port (with fallback to the HTTP Host header).
    static <REQUEST, RESPONSE>
    io.opentelemetry.instrumentation.api.instrumenter.AttributesExtractor<REQUEST,RESPONSE>
    create(io.opentelemetry.instrumentation.api.semconv.http.HttpClientAttributesGetter<REQUEST,RESPONSE> attributesGetter, ServicePeerResolver servicePeerResolver)
    void
    onEnd(io.opentelemetry.api.common.AttributesBuilder attributes, io.opentelemetry.context.Context context, REQUEST request, RESPONSE response, Throwable error)
     
    void
    onStart(io.opentelemetry.api.common.AttributesBuilder attributes, io.opentelemetry.context.Context parentContext, REQUEST request)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • create

      public static <REQUEST, RESPONSE> io.opentelemetry.instrumentation.api.instrumenter.AttributesExtractor<REQUEST,RESPONSE> create(io.opentelemetry.instrumentation.api.semconv.http.HttpClientAttributesGetter<REQUEST,RESPONSE> attributesGetter, io.opentelemetry.api.OpenTelemetry openTelemetry)
      Returns a new HttpClientServicePeerAttributesExtractor that will use the passed attributesGetter to extract server address and port (with fallback to the HTTP Host header).
      Parameters:
      attributesGetter - the getter to extract HTTP client attributes from the request
      openTelemetry - the OpenTelemetry instance to read service peer mapping configuration from
    • create

      @Deprecated public static <REQUEST, RESPONSE> io.opentelemetry.instrumentation.api.instrumenter.AttributesExtractor<REQUEST,RESPONSE> create(io.opentelemetry.instrumentation.api.semconv.http.HttpClientAttributesGetter<REQUEST,RESPONSE> attributesGetter, ServicePeerResolver servicePeerResolver)
      This method is internal and is hence not for public use. Its APIs are unstable and can change at any time.

      This method only exists to bridge the deprecated HttpClientPeerServiceAttributesExtractor.

    • 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>