Interface Propagator
public interface Propagator
Inspired by OpenZipkin Brave and OpenTelemetry. Most of the documentation is taken
directly from OpenTelemetry.
Injects and extracts a value as text into carriers that travel in-band across process boundaries. Encoding is expected to conform to the HTTP Header Field semantics. Values are often encoded as RPC/HTTP request headers.
- Since:
- 1.0.0
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic interface
Interface that allows aTextMapPropagator
to read propagated fields from a carrier.static interface
Class that allows aTextMapPropagator
to set propagated fields into a carrier. -
Method Summary
Modifier and TypeMethodDescription<C> Span.Builder
extract
(C carrier, Propagator.Getter<C> getter) Extracts the value from upstream.fields()
<C> void
inject
(TraceContext context, C carrier, Propagator.Setter<C> setter) Injects the value downstream, for example as HTTP headers.
-
Method Details
-
fields
- Returns:
- collection of headers that contain tracing information
-
inject
Injects the value downstream, for example as HTTP headers. The carrier may be null to facilitate calling this method with a lambda for thePropagator.Setter
, in which case that null will be passed to thePropagator.Setter
implementation.- Type Parameters:
C
- carrier of propagation fields, such as an http request- Parameters:
context
- theContext
containing the value to be injected.carrier
- holds propagation fields. For example, an outgoing message or http request.setter
- invoked for each propagation key to add or remove.
-
extract
Extracts the value from upstream. For example, as http headers.If the value could not be parsed, the underlying implementation will decide to set an object representing either an empty value, an invalid value, or a valid value. Implementation must not set
null
.- Type Parameters:
C
- carrier of propagation fields, such as an http request.- Parameters:
carrier
- holds propagation fields. For example, an outgoing message or http request.getter
- invoked for each propagation key to get.- Returns:
- the
Context
containing the extracted value.
-