Class TraceContextFormat
- java.lang.Object
-
- io.opencensus.trace.propagation.TextFormat
-
- io.opencensus.implcore.trace.propagation.TraceContextFormat
-
public class TraceContextFormat extends TextFormat
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
Fields Modifier and Type Field Description private static java.util.List<java.lang.String>
FIELDS
private static int
SPAN_ID_HEX_SIZE
private static int
SPAN_ID_OFFSET
private static int
TRACE_ID_HEX_SIZE
private static int
TRACE_ID_OFFSET
private static int
TRACE_OPTION_HEX_SIZE
private static int
TRACE_OPTION_OFFSET
(package private) static java.lang.String
TRACEPARENT
private static char
TRACEPARENT_DELIMITER
private static int
TRACEPARENT_DELIMITER_SIZE
private static int
TRACEPARENT_HEADER_SIZE
(package private) static java.lang.String
TRACESTATE
private static Tracestate
TRACESTATE_DEFAULT
private static char
TRACESTATE_ENTRY_DELIMITER
private static com.google.common.base.Splitter
TRACESTATE_ENTRY_DELIMITER_SPLITTER
private static char
TRACESTATE_KEY_VALUE_DELIMITER
private static int
TRACESTATE_MAX_MEMBERS
private static int
TRACESTATE_MAX_SIZE
private static java.lang.String
VERSION
private static int
VERSION_SIZE
-
Constructor Summary
Constructors Constructor Description TraceContextFormat()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <C> SpanContext
extract(C carrier, TextFormat.Getter<C> getter)
Extracts the span context from upstream.java.util.List<java.lang.String>
fields()
The propagation fields defined.<C> void
inject(SpanContext spanContext, C carrier, TextFormat.Setter<C> setter)
Injects the span context downstream.
-
-
-
Field Detail
-
TRACESTATE_DEFAULT
private static final Tracestate TRACESTATE_DEFAULT
-
TRACEPARENT
static final java.lang.String TRACEPARENT
- See Also:
- Constant Field Values
-
TRACESTATE
static final java.lang.String TRACESTATE
- See Also:
- Constant Field Values
-
FIELDS
private static final java.util.List<java.lang.String> FIELDS
-
VERSION
private static final java.lang.String VERSION
- See Also:
- Constant Field Values
-
VERSION_SIZE
private static final int VERSION_SIZE
- See Also:
- Constant Field Values
-
TRACEPARENT_DELIMITER
private static final char TRACEPARENT_DELIMITER
- See Also:
- Constant Field Values
-
TRACEPARENT_DELIMITER_SIZE
private static final int TRACEPARENT_DELIMITER_SIZE
- See Also:
- Constant Field Values
-
TRACE_ID_HEX_SIZE
private static final int TRACE_ID_HEX_SIZE
- See Also:
- Constant Field Values
-
SPAN_ID_HEX_SIZE
private static final int SPAN_ID_HEX_SIZE
- See Also:
- Constant Field Values
-
TRACE_OPTION_HEX_SIZE
private static final int TRACE_OPTION_HEX_SIZE
- See Also:
- Constant Field Values
-
TRACE_ID_OFFSET
private static final int TRACE_ID_OFFSET
- See Also:
- Constant Field Values
-
SPAN_ID_OFFSET
private static final int SPAN_ID_OFFSET
- See Also:
- Constant Field Values
-
TRACE_OPTION_OFFSET
private static final int TRACE_OPTION_OFFSET
- See Also:
- Constant Field Values
-
TRACEPARENT_HEADER_SIZE
private static final int TRACEPARENT_HEADER_SIZE
- See Also:
- Constant Field Values
-
TRACESTATE_MAX_SIZE
private static final int TRACESTATE_MAX_SIZE
- See Also:
- Constant Field Values
-
TRACESTATE_MAX_MEMBERS
private static final int TRACESTATE_MAX_MEMBERS
- See Also:
- Constant Field Values
-
TRACESTATE_KEY_VALUE_DELIMITER
private static final char TRACESTATE_KEY_VALUE_DELIMITER
- See Also:
- Constant Field Values
-
TRACESTATE_ENTRY_DELIMITER
private static final char TRACESTATE_ENTRY_DELIMITER
- See Also:
- Constant Field Values
-
TRACESTATE_ENTRY_DELIMITER_SPLITTER
private static final com.google.common.base.Splitter TRACESTATE_ENTRY_DELIMITER_SPLITTER
-
-
Method Detail
-
fields
public java.util.List<java.lang.String> 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
public <C> void inject(SpanContext spanContext, C carrier, TextFormat.Setter<C> setter)
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
-
-