Class DefaultHttpServerInstrumenterBuilder<REQUEST,RESPONSE>

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

public final class DefaultHttpServerInstrumenterBuilder<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> DefaultHttpServerInstrumenterBuilder<REQUEST,RESPONSE> create(String instrumentationName, io.opentelemetry.api.OpenTelemetry openTelemetry, io.opentelemetry.instrumentation.api.semconv.http.HttpServerAttributesGetter<REQUEST,RESPONSE> attributesGetter)
    • create

      public static <REQUEST, RESPONSE> DefaultHttpServerInstrumenterBuilder<REQUEST,RESPONSE> create(String instrumentationName, io.opentelemetry.api.OpenTelemetry openTelemetry, io.opentelemetry.instrumentation.api.semconv.http.HttpServerAttributesGetter<REQUEST,RESPONSE> attributesGetter, io.opentelemetry.context.propagation.TextMapGetter<REQUEST> headerGetter)
    • addAttributesExtractor

      @CanIgnoreReturnValue public DefaultHttpServerInstrumenterBuilder<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.
    • setSpanStatusExtractorCustomizer

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

      @CanIgnoreReturnValue public DefaultHttpServerInstrumenterBuilder<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 DefaultHttpServerInstrumenterBuilder<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 DefaultHttpServerInstrumenterBuilder<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 DefaultHttpServerInstrumenterBuilder<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 DefaultHttpServerInstrumenterBuilder<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:
      • HttpServerAttributesExtractorBuilder.setKnownMethods(Collection)
    • setEmitExperimentalHttpServerTelemetry

      @CanIgnoreReturnValue public DefaultHttpServerInstrumenterBuilder<REQUEST,RESPONSE> setEmitExperimentalHttpServerTelemetry(boolean emitExperimentalHttpServerTelemetry)
      Configures the instrumentation to emit experimental HTTP server telemetry.
      Parameters:
      emitExperimentalHttpServerTelemetry - true if the experimental HTTP server telemetry is to be emitted.
    • setSensitiveQueryParameters

      @CanIgnoreReturnValue public DefaultHttpServerInstrumenterBuilder<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 DefaultHttpServerInstrumenterBuilder<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 DefaultHttpServerInstrumenterBuilder<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 io.opentelemetry.instrumentation.api.instrumenter.InstrumenterBuilder<REQUEST,RESPONSE> instrumenterBuilder()
    • configure

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