-
- Type Parameters:
K- Usually, but not always a String
- All Known Implementing Classes:
B3Propagation,B3SinglePropagation,ExtraFieldPropagation
public interface Propagation<K>Injects and extractstrace identifiersas text into carriers that travel in-band across process boundaries. Identifiers are often encoded as messaging or RPC request headers.Propagation example: Http
When using http, the carrier of propagated data on both the client (injector) and server (extractor) side is usually an http request. Propagation is usually implemented via library- specific request interceptors, where the client-side injects span identifiers and the server-side extracts them.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classPropagation.Factorystatic interfacePropagation.Getter<C,K>Gets the first value of the given propagation key or returns nullstatic interfacePropagation.KeyFactory<K>Creates keys for use in propagated contextsstatic interfacePropagation.Setter<C,K>Replaces a propagated key with the given value
-
Field Summary
Fields Modifier and Type Field Description static Propagation<java.lang.String>B3_SINGLE_STRINGstatic Propagation<java.lang.String>B3_STRING
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description <C> TraceContext.Extractor<C>extractor(Propagation.Getter<C,K> getter)<C> TraceContext.Injector<C>injector(Propagation.Setter<C,K> setter)Replaces a propagated field with the given value.java.util.List<K>keys()The propagation fields defined.
-
-
-
Field Detail
-
B3_STRING
static final Propagation<java.lang.String> B3_STRING
-
B3_SINGLE_STRING
static final Propagation<java.lang.String> B3_SINGLE_STRING
-
-
Method Detail
-
keys
java.util.List<K> keys()
The propagation fields defined. If your carrier is reused, you should delete the fields here before callingPropagation.Setter.put(Object, Object, String).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.
Note: If your implementation carries "extra fields", such as correlation IDs, do not return the names of those fields here. If you do, they will be deleted, which can interfere with user headers.
-
injector
<C> TraceContext.Injector<C> injector(Propagation.Setter<C,K> setter)
Replaces a propagated field with the given value. Saved as a constant to avoid runtime allocations. For example, a setter for anHttpURLConnectionwould be the method referenceURLConnection.addRequestProperty(String, String)- Parameters:
setter- invoked for each propagation key to add.
-
extractor
<C> TraceContext.Extractor<C> extractor(Propagation.Getter<C,K> getter)
- Parameters:
getter- invoked for each propagation key to get.
-
-