Class DefaultHttpClientInstrumenterBuilder<REQUEST,RESPONSE>

java.lang.Object
io.opentelemetry.instrumentation.api.incubator.builder.internal.DefaultHttpClientInstrumenterBuilder<REQUEST,RESPONSE>

public final class DefaultHttpClientInstrumenterBuilder<REQUEST,RESPONSE> extends Object
This class is internal and is hence not for public use. Its APIs are unstable and can change at any time.
  • Method Details

    • create

      public static <REQUEST, RESPONSE> DefaultHttpClientInstrumenterBuilder<REQUEST,RESPONSE> create(String instrumentationName, io.opentelemetry.api.OpenTelemetry openTelemetry, io.opentelemetry.instrumentation.api.semconv.http.HttpClientAttributesGetter<REQUEST,RESPONSE> attributesGetter)
    • create

      public static <REQUEST, RESPONSE> DefaultHttpClientInstrumenterBuilder<REQUEST,RESPONSE> create(String instrumentationName, io.opentelemetry.api.OpenTelemetry openTelemetry, io.opentelemetry.instrumentation.api.semconv.http.HttpClientAttributesGetter<REQUEST,RESPONSE> attributesGetter, io.opentelemetry.context.propagation.TextMapSetter<REQUEST> headerSetter)
    • addAttributeExtractor

      @CanIgnoreReturnValue public DefaultHttpClientInstrumenterBuilder<REQUEST,RESPONSE> addAttributeExtractor(io.opentelemetry.instrumentation.api.instrumenter.AttributesExtractor<? super REQUEST,? super RESPONSE> attributesExtractor)
      Adds an additional AttributesExtractor to invoke to set attributes to instrumented items. The AttributesExtractor will be executed after all default extractors.
    • setStatusExtractor

      @CanIgnoreReturnValue public DefaultHttpClientInstrumenterBuilder<REQUEST,RESPONSE> setStatusExtractor(Function<io.opentelemetry.instrumentation.api.instrumenter.SpanStatusExtractor<? super REQUEST,? super RESPONSE>,? extends io.opentelemetry.instrumentation.api.instrumenter.SpanStatusExtractor<? super REQUEST,? super RESPONSE>> statusExtractor)
    • setCapturedRequestHeaders

      @CanIgnoreReturnValue public DefaultHttpClientInstrumenterBuilder<REQUEST,RESPONSE> setCapturedRequestHeaders(List<String> requestHeaders)
      Configures the HTTP request headers that will be captured as span attributes.
      Parameters:
      requestHeaders - A list of HTTP header names.
    • setCapturedResponseHeaders

      @CanIgnoreReturnValue public DefaultHttpClientInstrumenterBuilder<REQUEST,RESPONSE> setCapturedResponseHeaders(List<String> responseHeaders)
      Configures the HTTP response headers that will be captured as span attributes.
      Parameters:
      responseHeaders - A list of HTTP header names.
    • setKnownMethods

      @CanIgnoreReturnValue public DefaultHttpClientInstrumenterBuilder<REQUEST,RESPONSE> setKnownMethods(Set<String> knownMethods)
      Configures the instrumentation to recognize an alternative set of HTTP request methods.

      By default, this instrumentation defines "known" methods as the ones listed in RFC9110 and the PATCH method defined in RFC5789.

      Note: calling this method overrides the default known method sets completely; it does not supplement it.

      Parameters:
      knownMethods - A set of recognized HTTP request methods.
      See Also:
      • HttpClientAttributesExtractorBuilder.setKnownMethods(Set)
    • setEmitExperimentalHttpClientMetrics

      @CanIgnoreReturnValue public DefaultHttpClientInstrumenterBuilder<REQUEST,RESPONSE> setEmitExperimentalHttpClientMetrics(boolean emitExperimentalHttpClientMetrics)
      Configures the instrumentation to emit experimental HTTP client metrics.
      Parameters:
      emitExperimentalHttpClientMetrics - true if the experimental HTTP client metrics are to be emitted.
    • setSpanNameExtractor

      @CanIgnoreReturnValue public DefaultHttpClientInstrumenterBuilder<REQUEST,RESPONSE> setSpanNameExtractor(Function<io.opentelemetry.instrumentation.api.instrumenter.SpanNameExtractor<? super REQUEST>,? extends io.opentelemetry.instrumentation.api.instrumenter.SpanNameExtractor<? super REQUEST>> spanNameExtractorTransformer)
      Sets custom SpanNameExtractor via transform function.
    • setPeerServiceResolver

      @CanIgnoreReturnValue public DefaultHttpClientInstrumenterBuilder<REQUEST,RESPONSE> setPeerServiceResolver(PeerServiceResolver peerServiceResolver)
      Sets custom PeerServiceResolver.
    • setPeerService

      @CanIgnoreReturnValue public DefaultHttpClientInstrumenterBuilder<REQUEST,RESPONSE> setPeerService(String peerService)
      Sets the peer.service attribute for http client spans.
    • setBuilderCustomizer

      @CanIgnoreReturnValue public DefaultHttpClientInstrumenterBuilder<REQUEST,RESPONSE> setBuilderCustomizer(Consumer<io.opentelemetry.instrumentation.api.instrumenter.InstrumenterBuilder<REQUEST,RESPONSE>> builderCustomizer)
    • build

      public io.opentelemetry.instrumentation.api.instrumenter.Instrumenter<REQUEST,RESPONSE> build()
    • instrumenterBuilder

      public <BUILDERREQUEST, BUILDERRESPONSE> io.opentelemetry.instrumentation.api.instrumenter.InstrumenterBuilder<BUILDERREQUEST,BUILDERRESPONSE> instrumenterBuilder(io.opentelemetry.instrumentation.api.instrumenter.SpanNameExtractor<? super BUILDERREQUEST> spanNameExtractor)
    • configure

      @CanIgnoreReturnValue public DefaultHttpClientInstrumenterBuilder<REQUEST,RESPONSE> configure(CommonConfig config)