Module brave

Interface Propagation<K>

  • Type Parameters:
    K - Usually, but not always a String
    All Known Implementing Classes:
    B3Propagation, B3SinglePropagation, ExtraFieldPropagation

    public interface Propagation<K>
    Injects and extracts trace identifiers as text into carriers that travel in-band across process boundaries. Identifiers are often encoded as messaging or RPC request headers.

    Propagation example: Http

    When using http, the carrier of propagated data on both the client (injector) and server (extractor) side is usually an http request. Propagation is usually implemented via library- specific request interceptors, where the client-side injects span identifiers and the server-side extracts them.

    • Field Detail

      • B3_STRING

        static final Propagation<java.lang.String> B3_STRING
      • B3_SINGLE_STRING

        static final Propagation<java.lang.String> B3_SINGLE_STRING
    • Method Detail

      • keys

        java.util.List<K> keys()
        The propagation fields defined. If your carrier is reused, you should delete the fields here before calling Propagation.Setter.put(Object, Object, String).

        For example, if the carrier is a single-use or immutable request object, you don't need to clear fields as they couldn't have been set before. If it is a mutable, retryable object, successive calls should clear these fields first.

        Note: If your implementation carries "extra fields", such as correlation IDs, do not return the names of those fields here. If you do, they will be deleted, which can interfere with user headers.

      • injector

        <C> TraceContext.Injector<C> injector​(Propagation.Setter<C,​K> setter)
        Replaces a propagated field with the given value. Saved as a constant to avoid runtime allocations. For example, a setter for an HttpURLConnection would be the method reference URLConnection.addRequestProperty(String, String)
        Parameters:
        setter - invoked for each propagation key to add.