Class DefaultHttpServerInstrumenterBuilder<REQUEST,RESPONSE>
java.lang.Object
io.opentelemetry.instrumentation.api.incubator.builder.internal.DefaultHttpServerInstrumenterBuilder<REQUEST,RESPONSE>
This class is internal and is hence not for public use. Its APIs are unstable and can change at
any time.
-
Method Summary
Modifier and TypeMethodDescriptionaddAttributesExtractor(io.opentelemetry.instrumentation.api.instrumenter.AttributesExtractor<? super REQUEST, ? super RESPONSE> attributesExtractor) Adds an additionalAttributesExtractorto invoke to set attributes to instrumented items.build()configure(CommonConfig config) static <REQUEST,RESPONSE>
DefaultHttpServerInstrumenterBuilder<REQUEST, RESPONSE> create(String instrumentationName, io.opentelemetry.api.OpenTelemetry openTelemetry, io.opentelemetry.instrumentation.api.semconv.http.HttpServerAttributesGetter<REQUEST, RESPONSE> attributesGetter) 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) setBuilderCustomizer(Consumer<io.opentelemetry.instrumentation.api.instrumenter.InstrumenterBuilder<REQUEST, RESPONSE>> builderCustomizer) setCapturedRequestHeaders(Collection<String> requestHeaders) Configures the HTTP request headers that will be captured as span attributes.setCapturedResponseHeaders(Collection<String> responseHeaders) Configures the HTTP response headers that will be captured as span attributes.setEmitExperimentalHttpServerMetrics(boolean emitExperimentalHttpServerMetrics) Configures the instrumentation to emit experimental HTTP server metrics.setKnownMethods(Collection<String> knownMethods) Configures the instrumentation to recognize an alternative set of HTTP request methods.setSpanNameExtractor(Function<io.opentelemetry.instrumentation.api.instrumenter.SpanNameExtractor<? super REQUEST>, ? extends io.opentelemetry.instrumentation.api.instrumenter.SpanNameExtractor<? super REQUEST>> spanNameExtractorTransformer) Sets customSpanNameExtractorvia transform function.setStatusExtractor(Function<io.opentelemetry.instrumentation.api.instrumenter.SpanStatusExtractor<? super REQUEST, ? super RESPONSE>, ? extends io.opentelemetry.instrumentation.api.instrumenter.SpanStatusExtractor<? super REQUEST, ? super RESPONSE>> statusExtractor)
-
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 additionalAttributesExtractorto invoke to set attributes to instrumented items. -
setStatusExtractor
@CanIgnoreReturnValue public DefaultHttpServerInstrumenterBuilder<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 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:
-
setEmitExperimentalHttpServerMetrics
@CanIgnoreReturnValue public DefaultHttpServerInstrumenterBuilder<REQUEST,RESPONSE> setEmitExperimentalHttpServerMetrics(boolean emitExperimentalHttpServerMetrics) Configures the instrumentation to emit experimental HTTP server metrics.- Parameters:
emitExperimentalHttpServerMetrics-trueif the experimental HTTP server metrics are to be emitted.
-
setSpanNameExtractor
@CanIgnoreReturnValue public DefaultHttpServerInstrumenterBuilder<REQUEST,RESPONSE> setSpanNameExtractor(Function<io.opentelemetry.instrumentation.api.instrumenter.SpanNameExtractor<? super REQUEST>, ? extends io.opentelemetry.instrumentation.api.instrumenter.SpanNameExtractor<? super REQUEST>> spanNameExtractorTransformer) Sets customSpanNameExtractorvia transform function. -
setBuilderCustomizer
-
build
-
instrumenterBuilder
-
configure
@CanIgnoreReturnValue public DefaultHttpServerInstrumenterBuilder<REQUEST,RESPONSE> configure(CommonConfig config)
-