Class B3Format
- java.lang.Object
-
- io.opencensus.trace.propagation.TextFormat
-
- io.opencensus.implcore.trace.propagation.B3Format
-
final class B3Format extends TextFormat
Implementation of the B3 propagation protocol. See b3-propagation.
-
-
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 java.lang.String
FLAGS_VALUE
private static java.lang.String
SAMPLED_VALUE
private static Tracestate
TRACESTATE_DEFAULT
private static java.lang.String
UPPER_TRACE_ID
(package private) static java.lang.String
X_B3_FLAGS
(package private) static java.lang.String
X_B3_PARENT_SPAN_ID
(package private) static java.lang.String
X_B3_SAMPLED
(package private) static java.lang.String
X_B3_SPAN_ID
(package private) static java.lang.String
X_B3_TRACE_ID
-
Constructor Summary
Constructors Constructor Description B3Format()
-
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
-
X_B3_TRACE_ID
static final java.lang.String X_B3_TRACE_ID
- See Also:
- Constant Field Values
-
X_B3_SPAN_ID
static final java.lang.String X_B3_SPAN_ID
- See Also:
- Constant Field Values
-
X_B3_PARENT_SPAN_ID
static final java.lang.String X_B3_PARENT_SPAN_ID
- See Also:
- Constant Field Values
-
X_B3_SAMPLED
static final java.lang.String X_B3_SAMPLED
- See Also:
- Constant Field Values
-
X_B3_FLAGS
static final java.lang.String X_B3_FLAGS
- See Also:
- Constant Field Values
-
FIELDS
private static final java.util.List<java.lang.String> FIELDS
-
UPPER_TRACE_ID
private static final java.lang.String UPPER_TRACE_ID
- See Also:
- Constant Field Values
-
SAMPLED_VALUE
private static final java.lang.String SAMPLED_VALUE
- See Also:
- Constant Field Values
-
FLAGS_VALUE
private static final java.lang.String FLAGS_VALUE
- See Also:
- Constant Field Values
-
-
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
-
-