Class Propagators

java.lang.Object
org.microproxy.otel.Propagators

public final class Propagators extends Object
The propagators, by the names OTEL_PROPAGATORS uses: tracecontext (W3C Trace Context: traceparent and tracestate), b3 (B3's single b3 header), b3multi (B3's X-B3-* headers) and jaeger ( uber-trace-id). baggage is accepted and leaves the baggage header as it is.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final Propagator
    B3 in one header: b3: {trace-id}-{span-id}-{sampled}.
    static final Propagator
    B3 in several headers: X-B3-TraceId, X-B3-SpanId, X-B3-Sampled.
    static final Propagator
    Jaeger's uber-trace-id: {trace-id}:{span-id}:{parent-span-id}:{flags}.
    static final Propagator
    W3C Trace Context (traceparent, tracestate), version 00.
  • Method Summary

    Modifier and Type
    Method
    Description
    static String
    Formats a traceparent value, version 00, with only the sampled flag.
    parse(String list)
    The propagators named in list, a comma-separated list as in OTEL_PROPAGATORS: tracecontext, b3, b3multi, jaeger; baggage adds none (baggage passes through untouched), and none means none at all.
    Parses a traceparent value as W3C Trace Context says: version 00 exactly (00-<32 hex>-<16 hex>-<2 hex>, lower-case), or a later version that starts the same way and continues only after a -; never version ff, an all-zero trace id or an all-zero parent id.
    static String
    Parses the tracestate header's values (several are joined with commas, as HTTP does): up to 32 list members key=value, separated by commas with optional spaces and tabs around them, empty members ignored.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • TRACE_CONTEXT

      public static final Propagator TRACE_CONTEXT
      W3C Trace Context (traceparent, tracestate), version 00.
    • B3

      public static final Propagator B3
      B3 in one header: b3: {trace-id}-{span-id}-{sampled}.
    • B3_MULTI

      public static final Propagator B3_MULTI
      B3 in several headers: X-B3-TraceId, X-B3-SpanId, X-B3-Sampled.
    • JAEGER

      public static final Propagator JAEGER
      Jaeger's uber-trace-id: {trace-id}:{span-id}:{parent-span-id}:{flags}.
  • Method Details

    • parse

      public static List<Propagator> parse(String list)
      The propagators named in list, a comma-separated list as in OTEL_PROPAGATORS: tracecontext, b3, b3multi, jaeger; baggage adds none (baggage passes through untouched), and none means none at all.
      Parameters:
      list - the names
      Returns:
      the propagators, in order, without duplicates
      Throws:
      IllegalArgumentException - for a name this module does not know
    • parseTraceparent

      public static SpanContext parseTraceparent(String value)
      Parses a traceparent value as W3C Trace Context says: version 00 exactly (00-<32 hex>-<16 hex>-<2 hex>, lower-case), or a later version that starts the same way and continues only after a -; never version ff, an all-zero trace id or an all-zero parent id.
      Parameters:
      value - the header's value
      Returns:
      the remote context, without tracestate, or null when it is not valid
    • formatTraceparent

      public static String formatTraceparent(SpanContext context)
      Formats a traceparent value, version 00, with only the sampled flag.
      Parameters:
      context - the context
      Returns:
      00-<trace-id>-<span-id>-<flags>
    • parseTracestate

      public static String parseTracestate(List<String> values)
      Parses the tracestate header's values (several are joined with commas, as HTTP does): up to 32 list members key=value, separated by commas with optional spaces and tabs around them, empty members ignored. A key is a simple key (a lower-case letter, then up to 255 lower-case letters, digits, _, -, * and /) or a multi-tenant one (tenant@system); a value is 1 to 256 printable characters but , and =, not ending in a space.
      Parameters:
      values - the header's values
      Returns:
      the members joined with commas, an empty string for none, or null when the list is not valid (a malformed member, a duplicate key, too many members) and must be dropped