Class SpringWebTelemetryBuilder
java.lang.Object
io.opentelemetry.instrumentation.spring.web.v3_1.SpringWebTelemetryBuilder
A builder of
SpringWebTelemetry.-
Method Summary
Modifier and TypeMethodDescriptionaddAttributesExtractor(io.opentelemetry.instrumentation.api.instrumenter.AttributesExtractor<org.springframework.http.HttpRequest, 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.setKnownMethods(Collection<String> knownMethods) Configures the instrumentation to recognize an alternative set of HTTP request methods.setSpanNameExtractor(Function<io.opentelemetry.instrumentation.api.instrumenter.SpanNameExtractor<org.springframework.http.HttpRequest>, io.opentelemetry.instrumentation.api.instrumenter.SpanNameExtractor<org.springframework.http.HttpRequest>> spanNameExtractorTransformer) Sets customSpanNameExtractorvia transform function.
-
Method Details
-
addAttributesExtractor
@CanIgnoreReturnValue public SpringWebTelemetryBuilder addAttributesExtractor(io.opentelemetry.instrumentation.api.instrumenter.AttributesExtractor<org.springframework.http.HttpRequest, 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<org.springframework.http.HttpRequest>, io.opentelemetry.instrumentation.api.instrumenter.SpanNameExtractor<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:
-
build
Returns a newSpringWebTelemetrywith the settings of thisSpringWebTelemetryBuilder.
-