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

      @CanIgnoreReturnValue public DefaultHttpClientInstrumenterBuilder<REQUEST,RESPONSE> addAttributesExtractor(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.
    • setSpanStatusExtractorCustomizer

      @CanIgnoreReturnValue public DefaultHttpClientInstrumenterBuilder<REQUEST,RESPONSE> setSpanStatusExtractorCustomizer(UnaryOperator<io.opentelemetry.instrumentation.api.instrumenter.SpanStatusExtractor<REQUEST,RESPONSE>> spanStatusExtractorCustomizer)
    • setRequestHeaders

      @CanIgnoreReturnValue public DefaultHttpClientInstrumenterBuilder<REQUEST,RESPONSE> setRequestHeaders(io.opentelemetry.instrumentation.api.config.IncludeExclude requestHeaders)
      Configures which HTTP request headers are captured as span attributes.

      Selector patterns are matched case-insensitively, since HTTP header names are case-insensitive. ? matches one character and * matches any number of characters, including none. Excluded patterns take precedence over included patterns. A selector with no included patterns captures every header that is not excluded, and an empty selector captures no headers.

    • setCapturedRequestHeaders

      @CanIgnoreReturnValue public DefaultHttpClientInstrumenterBuilder<REQUEST,RESPONSE> setCapturedRequestHeaders(Collection<String> requestHeaders)
      Configures the HTTP request headers that will be captured as span attributes.

      The header names are matched literally, so * and ? are not treated as glob patterns.

      Parameters:
      requestHeaders - A list of HTTP header names.
    • setResponseHeaders

      @CanIgnoreReturnValue public DefaultHttpClientInstrumenterBuilder<REQUEST,RESPONSE> setResponseHeaders(io.opentelemetry.instrumentation.api.config.IncludeExclude responseHeaders)
      Configures which HTTP response headers are captured as span attributes.

      Selector patterns are matched case-insensitively, since HTTP header names are case-insensitive. ? matches one character and * matches any number of characters, including none. Excluded patterns take precedence over included patterns. A selector with no included patterns captures every header that is not excluded, and an empty selector captures no headers.

    • setCapturedResponseHeaders

      @CanIgnoreReturnValue public DefaultHttpClientInstrumenterBuilder<REQUEST,RESPONSE> setCapturedResponseHeaders(Collection<String> responseHeaders)
      Configures the HTTP response headers that will be captured as span attributes.

      The header names are matched literally, so * and ? are not treated as glob patterns.

      Parameters:
      responseHeaders - A list of HTTP header names.
    • setKnownMethods

      @CanIgnoreReturnValue public DefaultHttpClientInstrumenterBuilder<REQUEST,RESPONSE> setKnownMethods(Collection<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(Collection)
    • setEmitExperimentalHttpClientTelemetry

      @CanIgnoreReturnValue public DefaultHttpClientInstrumenterBuilder<REQUEST,RESPONSE> setEmitExperimentalHttpClientTelemetry(boolean emitExperimentalHttpClientTelemetry)
      Configures the instrumentation to emit experimental HTTP client telemetry.
      Parameters:
      emitExperimentalHttpClientTelemetry - true if the experimental HTTP client telemetry is to be emitted.
    • setSensitiveQueryParameters

      @CanIgnoreReturnValue public DefaultHttpClientInstrumenterBuilder<REQUEST,RESPONSE> setSensitiveQueryParameters(Set<String> sensitiveQueryParameters)
      Configures the instrumentation to redact specific URL query parameters.
      Parameters:
      sensitiveQueryParameters - the set of query parameter names whose values should be redacted.
    • setSpanNameExtractorCustomizer

      @CanIgnoreReturnValue public DefaultHttpClientInstrumenterBuilder<REQUEST,RESPONSE> setSpanNameExtractorCustomizer(UnaryOperator<io.opentelemetry.instrumentation.api.instrumenter.SpanNameExtractor<REQUEST>> spanNameExtractorCustomizer)
      Sets a customizer that receives the default SpanNameExtractor and returns a customized one.
    • 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)
    • setHttpClientExceptionEventExtractor

      public static <REQUEST> void setHttpClientExceptionEventExtractor(io.opentelemetry.instrumentation.api.instrumenter.InstrumenterBuilder<REQUEST,?> builder)
    • configure

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