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.StringCORRELATION_CONTEXTprivate static java.util.List<java.lang.String>FIELDS(package private) static intMAX_NUMBER_OF_TAGS(package private) static TagMetadataMETADATA_UNLIMITED_PROPAGATIONprivate CurrentStatestateprivate static charTAG_DELIMITERprivate static charTAG_KEY_VALUE_DELIMITERprivate static com.google.common.base.SplitterTAG_KEY_VALUE_SPLITTERprivate static charTAG_PROPERTIES_DELIMITERprivate static intTAG_SERIALIZED_SIZE_LIMITprivate static com.google.common.base.SplitterTAG_SPLITTERprivate static intTAGCONTEXT_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 voiddecodeTag(java.lang.String stringTag, java.util.Map<TagKey,TagValueWithMetadata> tags)private static intencodeTag(Tag tag, java.lang.StringBuilder stringBuilder)<C> TagContextextract(C carrier, TagContextTextFormat.Getter<C> getter)Extracts the tag context from upstream.java.util.List<java.lang.String>fields()The propagation fields defined.<C> voidinject(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:TagContextTextFormatThe 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:
fieldsin classTagContextTextFormat
-
inject
public <C> void inject(TagContext tagContext, C carrier, TagContextTextFormat.Setter<C> setter) throws TagContextSerializationException
Description copied from class:TagContextTextFormatInjects the tag context downstream. For example, as http headers.- Specified by:
injectin 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:TagContextTextFormatExtracts the tag context from upstream. For example, as http headers.- Specified by:
extractin 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)
-
-