Class W3CPropagation
- All Implemented Interfaces:
brave.propagation.Propagation<String>
Implementation of the TraceContext propagation protocol. See w3c/distributed-tracing.
- Since:
- 1.0.0
-
Nested Class Summary
Nested classes/interfaces inherited from interface brave.propagation.Propagation
brave.propagation.Propagation.Factory, brave.propagation.Propagation.Getter<R,K>, brave.propagation.Propagation.KeyFactory<K>, brave.propagation.Propagation.RemoteGetter<R>, brave.propagation.Propagation.RemoteSetter<R>, brave.propagation.Propagation.Setter<R, K> -
Field Summary
Fields inherited from interface brave.propagation.Propagation
B3_SINGLE_STRING, B3_STRING -
Constructor Summary
ConstructorsConstructorDescriptionCreates an instance ofW3CPropagationwithout baggage support.W3CPropagation(io.micrometer.tracing.BaggageManager baggageManager, List<String> localFields) Creates an instance ofW3CPropagationwith baggage support. -
Method Summary
Methods inherited from class brave.propagation.Propagation.Factory
create, decorate, requires128BitTraceId, supportsJoin
-
Constructor Details
-
W3CPropagation
public W3CPropagation(io.micrometer.tracing.BaggageManager baggageManager, List<String> localFields) Creates an instance ofW3CPropagationwith baggage support.- Parameters:
baggageManager- baggage managerlocalFields- local fields to be registered as baggage
-
W3CPropagation
public W3CPropagation()Creates an instance ofW3CPropagationwithout baggage support.
-
-
Method Details
-
get
- Overrides:
getin classbrave.propagation.Propagation.Factory
-
keys
- Specified by:
keysin interfacebrave.propagation.Propagation<String>
-
injector
public <R> brave.propagation.TraceContext.Injector<R> injector(brave.propagation.Propagation.Setter<R, String> setter) - Specified by:
injectorin interfacebrave.propagation.Propagation<String>
-
extractor
public <R> brave.propagation.TraceContext.Extractor<R> extractor(brave.propagation.Propagation.Getter<R, String> getter) This does not set the shared flag when extracting headersTraceContext.shared()is not set here because it is not a remote propagation field.sharedis a field in the Zipkin JSON v2 format only set after header extraction, forSpan.Kind.SERVERspans implicitly viaTracer.joinSpan(TraceContext).Blindly setting
sharedregardless of this is harmful whenTracer.currentSpan()or similar are used, as any data tagged with these could also set the shared flag when reporting. Particularly, this can cause problems for multi- Span.Kind.CONSUMER spans. Regardless, setting invalid flags add overhead.In summary, while
sharedis propagated in-process, it has never been propagated out of process, and so should never be set when extracting headers. Hence, this code will not setTraceContext.shared().- Specified by:
extractorin interfacebrave.propagation.Propagation<String>
-