Class MessagingAttributesExtractorBuilder<REQUEST,RESPONSE>
MessagingAttributesExtractor.-
Method Summary
Modifier and TypeMethodDescriptionbuild()Returns a newMessagingAttributesExtractorwith the settings of thisMessagingAttributesExtractorBuilder.setCapturedHeaders(Collection<String> capturedHeaders) Deprecated.setHeaders(io.opentelemetry.instrumentation.api.config.IncludeExclude headers) Configures which message headers are captured as span attributes.
-
Method Details
-
setHeaders
@CanIgnoreReturnValue public MessagingAttributesExtractorBuilder<REQUEST,RESPONSE> setHeaders(io.opentelemetry.instrumentation.api.config.IncludeExclude headers) Configures which message headers are captured as span attributes.Header values are captured under the
messaging.header.<name>attribute key. The<name>part in the attribute key is the header name with dashes replaced by underscores unlessotel.instrumentation.common.v3-previewis enabled, in which case dashes are preserved.Selector patterns are matched case-sensitively.
?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. Exact included names are looked up directly, so those lookups follow the underlying messaging library's header-name case sensitivity.Header names that are not listed as exact included names are resolved through
MessagingAttributesGetter.getMessageHeaderNames(Object), so wildcard and exclude-only selectors only capture headers when the getter implements that method. -
setCapturedHeaders
@Deprecated @CanIgnoreReturnValue public MessagingAttributesExtractorBuilder<REQUEST,RESPONSE> setCapturedHeaders(Collection<String> capturedHeaders) Deprecated.UsesetHeaders(IncludeExclude)instead. May be removed in the next minor release.Configures the messaging headers that will be captured as span attributes.The messaging header values will be captured under the
messaging.header.<name>attribute key. The<name>part in the attribute key is the header name with dashes replaced by underscores unlessotel.instrumentation.common.v3-previewis enabled, in which case dashes are preserved.The header names are matched literally. Names containing
*or?are ignored and logged, since this setting never supported wildcards.- Parameters:
capturedHeaders- A list of messaging header names.
-
build
public io.opentelemetry.instrumentation.api.instrumenter.AttributesExtractor<REQUEST,RESPONSE> build()Returns a newMessagingAttributesExtractorwith the settings of thisMessagingAttributesExtractorBuilder.
-
setHeaders(IncludeExclude)instead.