Interface Propagator


public interface Propagator
Reads a trace context from request headers and writes one onto them, in one format: W3C Trace Context (Propagators.TRACE_CONTEXT), B3 in its single-header and multi-header forms (Propagators.B3, Propagators.B3_MULTI) or Jaeger's uber-trace-id (Propagators.JAEGER). The configured propagators form OpenTelemetry's composite propagator: they extract in order, each over what the previous ones found, so the last that finds a valid context gives the parent; and every one of them injects the proxy's context.
  • Method Summary

    Modifier and Type
    Method
    Description
    Reads the trace context in headers.
    Returns the headers this propagator reads and writes, lower-case.
    void
    inject(SpanContext context, HttpHeaders headers)
    Writes context onto headers, replacing this propagator's headers that were there.
    Returns the name OTEL_PROPAGATORS gives this propagator, such as tracecontext.
  • Method Details

    • name

      String name()
      Returns the name OTEL_PROPAGATORS gives this propagator, such as tracecontext.
      Returns:
      the name OTEL_PROPAGATORS gives this propagator, such as tracecontext
    • fields

      List<String> fields()
      Returns the headers this propagator reads and writes, lower-case.
      Returns:
      the headers this propagator reads and writes, lower-case
    • extract

      SpanContext extract(HttpHeaders headers)
      Reads the trace context in headers.
      Parameters:
      headers - the request's headers
      Returns:
      the remote context, or null when there is none or it is not valid
    • inject

      void inject(SpanContext context, HttpHeaders headers)
      Writes context onto headers, replacing this propagator's headers that were there.
      Parameters:
      context - the context to send on
      headers - the request's headers, changed in place