Class CorrelationContextFormat
java.lang.Object
io.opencensus.tags.propagation.TagContextTextFormat
io.opencensus.implcore.tags.propagation.CorrelationContextFormat
Implementation of the W3C correlation context propagation protocol. See w3c/correlation-context.
-
Nested Class Summary
Nested classes/interfaces inherited from class io.opencensus.tags.propagation.TagContextTextFormat
TagContextTextFormat.Getter<C>, TagContextTextFormat.Setter<C>
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) static final String
(package private) static final int
(package private) static final TagMetadata
private final CurrentState
private static final char
private static final char
private static final com.google.common.base.Splitter
private static final char
private static final int
private static final com.google.common.base.Splitter
private static final int
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static void
decodeTag
(String stringTag, Map<TagKey, TagValueWithMetadata> tags) private static int
encodeTag
(Tag tag, StringBuilder stringBuilder) <C> TagContext
extract
(C carrier, TagContextTextFormat.Getter<C> getter) Extracts the tag context from upstream.fields()
The propagation fields defined.<C> void
inject
(TagContext tagContext, C carrier, TagContextTextFormat.Setter<C> setter) Injects the tag context downstream.
-
Field Details
-
CORRELATION_CONTEXT
- See Also:
-
FIELDS
-
MAX_NUMBER_OF_TAGS
static final int MAX_NUMBER_OF_TAGS- See Also:
-
TAG_SERIALIZED_SIZE_LIMIT
private static final int TAG_SERIALIZED_SIZE_LIMIT- See Also:
-
TAGCONTEXT_SERIALIZED_SIZE_LIMIT
private static final int TAGCONTEXT_SERIALIZED_SIZE_LIMIT- See Also:
-
TAG_KEY_VALUE_DELIMITER
private static final char TAG_KEY_VALUE_DELIMITER- See Also:
-
TAG_DELIMITER
private static final char TAG_DELIMITER- See Also:
-
TAG_KEY_VALUE_SPLITTER
private static final com.google.common.base.Splitter TAG_KEY_VALUE_SPLITTER -
TAG_SPLITTER
private static final com.google.common.base.Splitter TAG_SPLITTER -
TAG_PROPERTIES_DELIMITER
private static final char TAG_PROPERTIES_DELIMITER- See Also:
-
METADATA_UNLIMITED_PROPAGATION
-
state
-
-
Constructor Details
-
CorrelationContextFormat
CorrelationContextFormat(CurrentState state)
-
-
Method Details
-
fields
Description copied from class:TagContextTextFormat
The propagation fields defined. If your carrier is reused, you should delete the fields here before callingTagContextTextFormat.inject(TagContext, Object, Setter)
.For example, if the carrier is a single-use or immutable request object, you don't need to clear fields as they couldn't have been set before. If it is a mutable, retryable object, successive calls should clear these fields first.
- Specified by:
fields
in classTagContextTextFormat
-
inject
public <C> void inject(TagContext tagContext, C carrier, TagContextTextFormat.Setter<C> setter) throws TagContextSerializationException Description copied from class:TagContextTextFormat
Injects the tag context downstream. For example, as http headers.- Specified by:
inject
in classTagContextTextFormat
- Parameters:
tagContext
- the tag context.carrier
- holds propagation fields. For example, an outgoing message or http request.setter
- invoked for each propagation key to add or remove.- Throws:
TagContextSerializationException
- if the given tag context cannot be serialized.
-
encodeTag
-
extract
public <C> TagContext extract(C carrier, TagContextTextFormat.Getter<C> getter) throws TagContextDeserializationException Description copied from class:TagContextTextFormat
Extracts the tag context from upstream. For example, as http headers.- Specified by:
extract
in classTagContextTextFormat
- Parameters:
carrier
- holds propagation fields. For example, an outgoing message or http request.getter
- invoked for each propagation key to get.- Throws:
TagContextDeserializationException
- if the input is invalid
-
decodeTag
-