Class JavaHttpClientTelemetryBuilder
java.lang.Object
io.opentelemetry.instrumentation.httpclient.JavaHttpClientTelemetryBuilder
-
Method Summary
Modifier and TypeMethodDescriptionaddAttributeExtractor(io.opentelemetry.instrumentation.api.instrumenter.AttributesExtractor<? super java.net.http.HttpRequest, ? super java.net.http.HttpResponse<?>> attributesExtractor) Adds an additionalAttributesExtractorto invoke to set attributes to instrumented items.build()setCapturedRequestHeaders(List<String> requestHeaders) Configures the HTTP client request headers that will be captured as span attributes.setCapturedResponseHeaders(List<String> responseHeaders) Configures the HTTP client response headers that will be captured as span attributes.setEmitExperimentalHttpClientMetrics(boolean emitExperimentalHttpClientMetrics) Configures the instrumentation to emit experimental HTTP client metrics.setKnownMethods(Set<String> knownMethods) Configures the instrumentation to recognize an alternative set of HTTP request methods.
-
Method Details
-
addAttributeExtractor
@CanIgnoreReturnValue public JavaHttpClientTelemetryBuilder addAttributeExtractor(io.opentelemetry.instrumentation.api.instrumenter.AttributesExtractor<? super java.net.http.HttpRequest, ? super java.net.http.HttpResponse<?>> attributesExtractor) Adds an additionalAttributesExtractorto invoke to set attributes to instrumented items. TheAttributesExtractorwill be executed after all default extractors. -
setCapturedRequestHeaders
@CanIgnoreReturnValue public JavaHttpClientTelemetryBuilder setCapturedRequestHeaders(List<String> requestHeaders) Configures the HTTP client request headers that will be captured as span attributes.- Parameters:
requestHeaders- A list of HTTP header names.
-
setCapturedResponseHeaders
@CanIgnoreReturnValue public JavaHttpClientTelemetryBuilder setCapturedResponseHeaders(List<String> responseHeaders) Configures the HTTP client response headers that will be captured as span attributes.- Parameters:
responseHeaders- A list of HTTP header names.
-
setKnownMethods
@CanIgnoreReturnValue public JavaHttpClientTelemetryBuilder setKnownMethods(Set<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:
-
HttpClientAttributesExtractorBuilder.setKnownMethods(Set)
-
setEmitExperimentalHttpClientMetrics
@CanIgnoreReturnValue public JavaHttpClientTelemetryBuilder setEmitExperimentalHttpClientMetrics(boolean emitExperimentalHttpClientMetrics) Configures the instrumentation to emit experimental HTTP client metrics.- Parameters:
emitExperimentalHttpClientMetrics-trueif the experimental HTTP client metrics are to be emitted.
-
build
-