Class HttpServerAttributesExtractorBuilder<REQUEST,RESPONSE>
HttpServerAttributesExtractor.- Since:
- 2.0.0
-
Method Summary
Modifier and TypeMethodDescriptionbuild()Returns a newHttpServerAttributesExtractorwith the settings of thisHttpServerAttributesExtractorBuilder.setCapturedRequestHeaders(Collection<String> requestHeaders) Deprecated.setCapturedRequestHeaders(List<String> requestHeaders) Deprecated.UsesetRequestHeaders(IncludeExclude)instead.setCapturedResponseHeaders(Collection<String> responseHeaders) Deprecated.UsesetResponseHeaders(IncludeExclude)instead.setCapturedResponseHeaders(List<String> responseHeaders) Deprecated.UsesetResponseHeaders(IncludeExclude)instead.setKnownMethods(Collection<String> knownMethods) Configures the extractor to recognize an alternative set of HTTP request methods.setKnownMethods(Set<String> knownMethods) Configures the extractor to recognize an alternative set of HTTP request methods.setRequestHeaders(IncludeExclude requestHeaders) Configures which HTTP request headers are captured as span attributes, as described in HTTP semantic conventions.setResponseHeaders(IncludeExclude responseHeaders) Configures which HTTP response headers are captured as span attributes, as described in HTTP semantic conventions.
-
Method Details
-
setRequestHeaders
@CanIgnoreReturnValue public HttpServerAttributesExtractorBuilder<REQUEST,RESPONSE> setRequestHeaders(IncludeExclude requestHeaders) Configures which HTTP request headers are captured as span attributes, as described in HTTP semantic conventions.Header values are captured under the
http.request.header.<key>attribute key. The<key>part in the attribute key is the lowercase header name.Selector patterns are matched case-insensitively, since HTTP header names are case-insensitive.
?matches one character and*matches any number of characters, including none. Excluded patterns take precedence over included patterns. A selector with no included patterns captures every header that is not excluded, and an empty selector captures no headers.Header names that are not listed as exact included names are resolved through
HttpCommonAttributesGetter.getHttpRequestHeaderNames(Object), so wildcard and exclude-only selectors only capture headers when the getter implements that method.- Since:
- 2.31.0
-
setCapturedRequestHeaders
@Deprecated @CanIgnoreReturnValue public HttpServerAttributesExtractorBuilder<REQUEST,RESPONSE> setCapturedRequestHeaders(Collection<String> requestHeaders) Deprecated.UsesetRequestHeaders(IncludeExclude)instead. To be removed in 3.0.Configures the HTTP request headers that will be captured as span attributes as described in HTTP semantic conventions.The HTTP request header values will be captured under the
http.request.header.<key>attribute key. The<key>part in the attribute key is the lowercase header name.The header names are matched literally, so
*and?are not treated as glob patterns.- Parameters:
requestHeaders- A list of HTTP header names.
-
setCapturedRequestHeaders
@Deprecated @CanIgnoreReturnValue public HttpServerAttributesExtractorBuilder<REQUEST,RESPONSE> setCapturedRequestHeaders(List<String> requestHeaders) Deprecated.UsesetRequestHeaders(IncludeExclude)instead. To be removed in 3.0.Configures the HTTP request headers that will be captured as span attributes as described in HTTP semantic conventions.The HTTP request header values will be captured under the
http.request.header.<key>attribute key. The<key>part in the attribute key is the lowercase header name.The header names are matched literally, so
*and?are not treated as glob patterns.- Parameters:
requestHeaders- A list of HTTP header names.
-
setResponseHeaders
@CanIgnoreReturnValue public HttpServerAttributesExtractorBuilder<REQUEST,RESPONSE> setResponseHeaders(IncludeExclude responseHeaders) Configures which HTTP response headers are captured as span attributes, as described in HTTP semantic conventions.Header values are captured under the
http.response.header.<key>attribute key. The<key>part in the attribute key is the lowercase header name.Selector patterns are matched case-insensitively, since HTTP header names are case-insensitive.
?matches one character and*matches any number of characters, including none. Excluded patterns take precedence over included patterns. A selector with no included patterns captures every header that is not excluded, and an empty selector captures no headers.Header names that are not listed as exact included names are resolved through
HttpCommonAttributesGetter.getHttpResponseHeaderNames(Object, Object), so wildcard and exclude-only selectors only capture headers when the getter implements that method.- Since:
- 2.31.0
-
setCapturedResponseHeaders
@Deprecated @CanIgnoreReturnValue public HttpServerAttributesExtractorBuilder<REQUEST,RESPONSE> setCapturedResponseHeaders(Collection<String> responseHeaders) Deprecated.UsesetResponseHeaders(IncludeExclude)instead. To be removed in 3.0.Configures the HTTP response headers that will be captured as span attributes as described in HTTP semantic conventions.The HTTP response header values will be captured under the
http.response.header.<key>attribute key. The<key>part in the attribute key is the lowercase header name.The header names are matched literally, so
*and?are not treated as glob patterns.- Parameters:
responseHeaders- A list of HTTP header names.
-
setCapturedResponseHeaders
@Deprecated @CanIgnoreReturnValue public HttpServerAttributesExtractorBuilder<REQUEST,RESPONSE> setCapturedResponseHeaders(List<String> responseHeaders) Deprecated.UsesetResponseHeaders(IncludeExclude)instead. To be removed in 3.0.Configures the HTTP response headers that will be captured as span attributes as described in HTTP semantic conventions.The HTTP response header values will be captured under the
http.response.header.<key>attribute key. The<key>part in the attribute key is the lowercase header name.The header names are matched literally, so
*and?are not treated as glob patterns.- Parameters:
responseHeaders- A list of HTTP header names.
-
setKnownMethods
@CanIgnoreReturnValue public HttpServerAttributesExtractorBuilder<REQUEST,RESPONSE> setKnownMethods(Collection<String> knownMethods) Configures the extractor to recognize an alternative set of HTTP request methods.By default, this extractor defines "known" methods as the ones listed in RFC9110 and the PATCH method defined in RFC5789. If an unknown method is encountered, the extractor will use the value "_OTHER" instead of it and put the original value in an extra
http.request.method_originalattribute.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.
-
setKnownMethods
@CanIgnoreReturnValue public HttpServerAttributesExtractorBuilder<REQUEST,RESPONSE> setKnownMethods(Set<String> knownMethods) Configures the extractor to recognize an alternative set of HTTP request methods.By default, this extractor defines "known" methods as the ones listed in RFC9110 and the PATCH method defined in RFC5789. If an unknown method is encountered, the extractor will use the value "_OTHER" instead of it and put the original value in an extra
http.request.method_originalattribute.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.
-
build
Returns a newHttpServerAttributesExtractorwith the settings of thisHttpServerAttributesExtractorBuilder.- See Also:
-
setRequestHeaders(IncludeExclude)instead.