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>FIELDSprivate static intSPAN_ID_HEX_SIZEprivate static intSPAN_ID_OFFSETprivate static intTRACE_ID_HEX_SIZEprivate static intTRACE_ID_OFFSETprivate static intTRACE_OPTION_HEX_SIZEprivate static intTRACE_OPTION_OFFSET(package private) static java.lang.StringTRACEPARENTprivate static charTRACEPARENT_DELIMITERprivate static intTRACEPARENT_DELIMITER_SIZEprivate static intTRACEPARENT_HEADER_SIZE(package private) static java.lang.StringTRACESTATEprivate static TracestateTRACESTATE_DEFAULTprivate static charTRACESTATE_ENTRY_DELIMITERprivate static com.google.common.base.SplitterTRACESTATE_ENTRY_DELIMITER_SPLITTERprivate static charTRACESTATE_KEY_VALUE_DELIMITERprivate static intTRACESTATE_MAX_MEMBERSprivate static intTRACESTATE_MAX_SIZEprivate static java.lang.StringVERSIONprivate static intVERSION_SIZE
-
Constructor Summary
Constructors Constructor Description TraceContextFormat()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <C> SpanContextextract(C carrier, TextFormat.Getter<C> getter)Extracts the span context from upstream.java.util.List<java.lang.String>fields()The propagation fields defined.<C> voidinject(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:TextFormatThe 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:
fieldsin classTextFormat
-
inject
public <C> void inject(SpanContext spanContext, C carrier, TextFormat.Setter<C> setter)
Description copied from class:TextFormatInjects the span context downstream. For example, as http headers.- Specified by:
injectin 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:TextFormatExtracts the span context from upstream. For example, as http headers.- Specified by:
extractin 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
-
-