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

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

      @CanIgnoreReturnValue public DefaultHttpServerInstrumenterBuilder<REQUEST,RESPONSE> setCapturedRequestHeaders(Collection<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 DefaultHttpServerInstrumenterBuilder<REQUEST,RESPONSE> setCapturedResponseHeaders(Collection<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 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.
    • setSpanNameExtractor

      @CanIgnoreReturnValue public DefaultHttpServerInstrumenterBuilder<REQUEST,RESPONSE> setSpanNameExtractor(Function<io.opentelemetry.instrumentation.api.instrumenter.SpanNameExtractor<REQUEST>,io.opentelemetry.instrumentation.api.instrumenter.SpanNameExtractor<REQUEST>> spanNameExtractorTransformer)
      Sets custom SpanNameExtractor via transform function.
    • 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)