Class TraceContextFormat
java.lang.Object
io.opencensus.trace.propagation.TextFormat
io.opencensus.implcore.trace.propagation.TraceContextFormat
Implementation of the TraceContext propagation protocol. See w3c/distributed-tracing.
-
Nested Class Summary
Nested classes/interfaces inherited from class io.opencensus.trace.propagation.TextFormat
TextFormat.Getter<C>, TextFormat.Setter<C>
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final int
private static final int
private static final int
private static final int
private static final int
private static final int
(package private) static final String
private static final char
private static final int
private static final int
(package private) static final String
private static final Tracestate
private static final char
private static final com.google.common.base.Splitter
private static final char
private static final int
private static final int
private static final String
private static final int
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<C> SpanContext
extract
(C carrier, TextFormat.Getter<C> getter) Extracts the span context from upstream.fields()
The propagation fields defined.<C> void
inject
(SpanContext spanContext, C carrier, TextFormat.Setter<C> setter) Injects the span context downstream.
-
Field Details
-
TRACESTATE_DEFAULT
-
TRACEPARENT
- See Also:
-
TRACESTATE
- See Also:
-
FIELDS
-
VERSION
- See Also:
-
VERSION_SIZE
private static final int VERSION_SIZE- See Also:
-
TRACEPARENT_DELIMITER
private static final char TRACEPARENT_DELIMITER- See Also:
-
TRACEPARENT_DELIMITER_SIZE
private static final int TRACEPARENT_DELIMITER_SIZE- See Also:
-
TRACE_ID_HEX_SIZE
private static final int TRACE_ID_HEX_SIZE- See Also:
-
SPAN_ID_HEX_SIZE
private static final int SPAN_ID_HEX_SIZE- See Also:
-
TRACE_OPTION_HEX_SIZE
private static final int TRACE_OPTION_HEX_SIZE- See Also:
-
TRACE_ID_OFFSET
private static final int TRACE_ID_OFFSET- See Also:
-
SPAN_ID_OFFSET
private static final int SPAN_ID_OFFSET- See Also:
-
TRACE_OPTION_OFFSET
private static final int TRACE_OPTION_OFFSET- See Also:
-
TRACEPARENT_HEADER_SIZE
private static final int TRACEPARENT_HEADER_SIZE- See Also:
-
TRACESTATE_MAX_SIZE
private static final int TRACESTATE_MAX_SIZE- See Also:
-
TRACESTATE_MAX_MEMBERS
private static final int TRACESTATE_MAX_MEMBERS- See Also:
-
TRACESTATE_KEY_VALUE_DELIMITER
private static final char TRACESTATE_KEY_VALUE_DELIMITER- See Also:
-
TRACESTATE_ENTRY_DELIMITER
private static final char TRACESTATE_ENTRY_DELIMITER- See Also:
-
TRACESTATE_ENTRY_DELIMITER_SPLITTER
private static final com.google.common.base.Splitter TRACESTATE_ENTRY_DELIMITER_SPLITTER
-
-
Constructor Details
-
TraceContextFormat
public TraceContextFormat()
-
-
Method Details
-
fields
Description copied from class:TextFormat
The propagation fields defined. If your carrier is reused, you should delete the fields here before callingTextFormat.inject(SpanContext, 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 classTextFormat
-
inject
Description copied from class:TextFormat
Injects the span context downstream. For example, as http headers.- Specified by:
inject
in classTextFormat
- Parameters:
spanContext
- possibly not sampled.carrier
- holds propagation fields. For example, an outgoing message or http request.setter
- invoked for each propagation key to add or remove.
-
extract
public <C> SpanContext extract(C carrier, TextFormat.Getter<C> getter) throws SpanContextParseException Description copied from class:TextFormat
Extracts the span context from upstream. For example, as http headers.- Specified by:
extract
in classTextFormat
- Parameters:
carrier
- holds propagation fields. For example, an outgoing message or http request.getter
- invoked for each propagation key to get.- Throws:
SpanContextParseException
- if the input is invalid
-