Class CorrelationContextFormat
- java.lang.Object
-
- io.opencensus.tags.propagation.TagContextTextFormat
-
- io.opencensus.implcore.tags.propagation.CorrelationContextFormat
-
final class CorrelationContextFormat extends TagContextTextFormat
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
Fields Modifier and Type Field Description (package private) static java.lang.String
CORRELATION_CONTEXT
private static java.util.List<java.lang.String>
FIELDS
(package private) static int
MAX_NUMBER_OF_TAGS
(package private) static TagMetadata
METADATA_UNLIMITED_PROPAGATION
private CurrentState
state
private static char
TAG_DELIMITER
private static char
TAG_KEY_VALUE_DELIMITER
private static com.google.common.base.Splitter
TAG_KEY_VALUE_SPLITTER
private static char
TAG_PROPERTIES_DELIMITER
private static int
TAG_SERIALIZED_SIZE_LIMIT
private static com.google.common.base.Splitter
TAG_SPLITTER
private static int
TAGCONTEXT_SERIALIZED_SIZE_LIMIT
-
Constructor Summary
Constructors Constructor Description CorrelationContextFormat(CurrentState state)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static void
decodeTag(java.lang.String stringTag, java.util.Map<TagKey,TagValueWithMetadata> tags)
private static int
encodeTag(Tag tag, java.lang.StringBuilder stringBuilder)
<C> TagContext
extract(C carrier, TagContextTextFormat.Getter<C> getter)
Extracts the tag context from upstream.java.util.List<java.lang.String>
fields()
The propagation fields defined.<C> void
inject(TagContext tagContext, C carrier, TagContextTextFormat.Setter<C> setter)
Injects the tag context downstream.
-
-
-
Field Detail
-
CORRELATION_CONTEXT
static final java.lang.String CORRELATION_CONTEXT
- See Also:
- Constant Field Values
-
FIELDS
private static final java.util.List<java.lang.String> FIELDS
-
MAX_NUMBER_OF_TAGS
static final int MAX_NUMBER_OF_TAGS
- See Also:
- Constant Field Values
-
TAG_SERIALIZED_SIZE_LIMIT
private static final int TAG_SERIALIZED_SIZE_LIMIT
- See Also:
- Constant Field Values
-
TAGCONTEXT_SERIALIZED_SIZE_LIMIT
private static final int TAGCONTEXT_SERIALIZED_SIZE_LIMIT
- See Also:
- Constant Field Values
-
TAG_KEY_VALUE_DELIMITER
private static final char TAG_KEY_VALUE_DELIMITER
- See Also:
- Constant Field Values
-
TAG_DELIMITER
private static final char TAG_DELIMITER
- See Also:
- Constant Field Values
-
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:
- Constant Field Values
-
METADATA_UNLIMITED_PROPAGATION
static final TagMetadata METADATA_UNLIMITED_PROPAGATION
-
state
private final CurrentState state
-
-
Constructor Detail
-
CorrelationContextFormat
CorrelationContextFormat(CurrentState state)
-
-
Method Detail
-
fields
public java.util.List<java.lang.String> 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
private static int encodeTag(Tag tag, java.lang.StringBuilder stringBuilder)
-
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
private static void decodeTag(java.lang.String stringTag, java.util.Map<TagKey,TagValueWithMetadata> tags)
-
-