Class SpringWebTelemetryBuilder
java.lang.Object
io.opentelemetry.instrumentation.spring.web.v3_1.SpringWebTelemetryBuilder
A builder of
SpringWebTelemetry.-
Method Summary
Modifier and TypeMethodDescriptionaddAttributeExtractor(io.opentelemetry.instrumentation.api.instrumenter.AttributesExtractor<? super org.springframework.http.HttpRequest, ? super org.springframework.http.client.ClientHttpResponse> attributesExtractor) Deprecated.addAttributesExtractor(io.opentelemetry.instrumentation.api.instrumenter.AttributesExtractor<? super org.springframework.http.HttpRequest, ? super org.springframework.http.client.ClientHttpResponse> attributesExtractor) Adds an additionalAttributesExtractorto invoke to set attributes to instrumented items.build()Returns a newSpringWebTelemetrywith the settings of thisSpringWebTelemetryBuilder.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.setEmitExperimentalHttpClientMetrics(boolean emitExperimentalHttpClientMetrics) Deprecated.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 org.springframework.http.HttpRequest>, ? extends io.opentelemetry.instrumentation.api.instrumenter.SpanNameExtractor<? super org.springframework.http.HttpRequest>> spanNameExtractorTransformer) Sets customSpanNameExtractorvia transform function.
-
Method Details
-
addAttributeExtractor
@Deprecated @CanIgnoreReturnValue public SpringWebTelemetryBuilder addAttributeExtractor(io.opentelemetry.instrumentation.api.instrumenter.AttributesExtractor<? super org.springframework.http.HttpRequest, ? super org.springframework.http.client.ClientHttpResponse> attributesExtractor) Deprecated.UseaddAttributesExtractor(AttributesExtractor)instead.Adds an additionalAttributesExtractorto invoke to set attributes to instrumented items. -
addAttributesExtractor
@CanIgnoreReturnValue public SpringWebTelemetryBuilder addAttributesExtractor(io.opentelemetry.instrumentation.api.instrumenter.AttributesExtractor<? super org.springframework.http.HttpRequest, ? super org.springframework.http.client.ClientHttpResponse> attributesExtractor) Adds an additionalAttributesExtractorto invoke to set attributes to instrumented items. -
setCapturedRequestHeaders
@CanIgnoreReturnValue public SpringWebTelemetryBuilder 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 SpringWebTelemetryBuilder setCapturedResponseHeaders(Collection<String> responseHeaders) Configures the HTTP response headers that will be captured as span attributes.- Parameters:
responseHeaders- A list of HTTP header names.
-
setSpanNameExtractor
@CanIgnoreReturnValue public SpringWebTelemetryBuilder setSpanNameExtractor(Function<io.opentelemetry.instrumentation.api.instrumenter.SpanNameExtractor<? super org.springframework.http.HttpRequest>, ? extends io.opentelemetry.instrumentation.api.instrumenter.SpanNameExtractor<? super org.springframework.http.HttpRequest>> spanNameExtractorTransformer) Sets customSpanNameExtractorvia transform function. -
setKnownMethods
@CanIgnoreReturnValue public SpringWebTelemetryBuilder 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:
-
setEmitExperimentalHttpClientMetrics
@Deprecated @CanIgnoreReturnValue public SpringWebTelemetryBuilder setEmitExperimentalHttpClientMetrics(boolean emitExperimentalHttpClientMetrics) Deprecated.Configures the instrumentation to emit experimental HTTP client metrics.- Parameters:
emitExperimentalHttpClientMetrics-trueif the experimental HTTP client metrics are to be emitted.
-
build
Returns a newSpringWebTelemetrywith the settings of thisSpringWebTelemetryBuilder.
-
addAttributesExtractor(AttributesExtractor)instead.