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:
    3.0.0
    Author:
    OpenZipkin Brave Authors, OpenTelemetry Authors, Marcin Grzejszczak
    • Method Detail

      • fields

        List<String> fields()
        Returns:
        collection of headers that contain tracing information
      • inject

        <C> void inject​(TraceContext context,
                        @Nullable
                        C carrier,
                        Propagator.Setter<C> setter)
        Injects the value downstream, for example as HTTP headers. The carrier may be null to facilitate calling this method with a lambda for the Propagator.Setter, in which case that null will be passed to the Propagator.Setter implementation.
        Type Parameters:
        C - carrier of propagation fields, such as an http request
        Parameters:
        context - the Context 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

        <C> Span.Builder extract​(C carrier,
                                 Propagator.Getter<C> getter)
        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.