Class Propagation.Factory

java.lang.Object
brave.propagation.Propagation.Factory
Direct Known Subclasses:
ExtraFieldPropagation.Factory
Enclosing interface:
Propagation<K>

public abstract static class Propagation.Factory
extends Object
Since:
4.0
  • Constructor Details

  • Method Details

    • supportsJoin

      public boolean supportsJoin()
      Does the propagation implementation support sharing client and server span IDs. For example, should an RPC server span share the same identifiers extracted from an incoming request? In usual B3 Propagation, the parent span ID is sent across the wire so that the client and server can share the same identifiers. Other propagation formats, like trace-context only propagate the calling trace and span ID, with an assumption that the receiver always starts a new child span. When join is supported, you can assume that when the parent span ID is null, you've been propagated a root span. When join is not supported, you must always fork a new child.
      Since:
      4.7
    • requires128BitTraceId

      public boolean requires128BitTraceId()
      Returns true if the implementation cannot use 64-bit trace IDs.
      Since:
      4.9
    • create

      @Deprecated public abstract <K> Propagation<K> create​(Propagation.KeyFactory<K> keyFactory)
      Deprecated.
      Since 5.12, use get()
      This is deprecated: end users and instrumentation should never call this, and instead use get().

      Implementation advice

      This is deprecated, but abstract. This means those implementing custom propagation formats will have to implement this until it is removed in Brave 6. If you are able to use a tool such as "maven-shade-plugin", consider using StringPropagationAdapter.
      Type Parameters:
      K - Deprecated except when a String.
      Since:
      4.0
      See Also:
      Propagation.KeyFactory.STRING
    • get

      public Propagation<String> get()
      Returns a possibly cached propagation instance.

      Implementations should override and implement this method directly.

      Since:
      5.12
    • decorate

      public TraceContext decorate​(TraceContext context)
      Decorates the input such that it can propagate extra state, such as a timestamp or baggage.

      Implementations are responsible for data scoping, if relevant. For example, if only global configuration is present, it could suffice to simply ensure that data is present. If data is span-scoped, an implementation might compare the context to its last span ID, copying on write or otherwise to ensure writes to one context don't affect another.

      Implementations should be idempotent, returning the same instance instead of re-applying change.

      Since:
      4.9
      See Also:
      TraceContext.extra()