Class ApacheHttpClientTelemetryBuilder
java.lang.Object
io.opentelemetry.instrumentation.apachehttpclient.v4_3.ApacheHttpClientTelemetryBuilder
A builder for
ApacheHttpClientTelemetry.-
Method Summary
Modifier and TypeMethodDescriptionaddAttributeExtractor(io.opentelemetry.instrumentation.api.instrumenter.AttributesExtractor<? super ApacheHttpClientRequest, ? super org.apache.http.HttpResponse> attributesExtractor) Adds an additionalAttributesExtractorto invoke to set attributes to instrumented items.build()Returns a newApacheHttpClientTelemetryconfigured with thisApacheHttpClientTelemetryBuilder.setCapturedRequestHeaders(List<String> requestHeaders) Configures the HTTP request headers that will be captured as span attributes.setCapturedResponseHeaders(List<String> responseHeaders) Configures the HTTP 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 ApacheHttpClientTelemetryBuilder addAttributeExtractor(io.opentelemetry.instrumentation.api.instrumenter.AttributesExtractor<? super ApacheHttpClientRequest, ? super org.apache.http.HttpResponse> attributesExtractor) Adds an additionalAttributesExtractorto invoke to set attributes to instrumented items. TheAttributesExtractorwill be executed after all default extractors. -
setCapturedRequestHeaders
@CanIgnoreReturnValue public ApacheHttpClientTelemetryBuilder setCapturedRequestHeaders(List<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 ApacheHttpClientTelemetryBuilder setCapturedResponseHeaders(List<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 ApacheHttpClientTelemetryBuilder 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 ApacheHttpClientTelemetryBuilder 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
Returns a newApacheHttpClientTelemetryconfigured with thisApacheHttpClientTelemetryBuilder.
-