Class TraceContextFormat

java.lang.Object
io.opencensus.trace.propagation.TextFormat
io.opencensus.implcore.trace.propagation.TraceContextFormat

public class TraceContextFormat extends TextFormat
Implementation of the TraceContext propagation protocol. See w3c/distributed-tracing.
  • Field Details

  • Constructor Details

    • TraceContextFormat

      public TraceContextFormat()
  • Method Details

    • fields

      public List<String> fields()
      Description copied from class: TextFormat
      The propagation fields defined. If your carrier is reused, you should delete the fields here before calling TextFormat.inject(SpanContext, Object, Setter).

      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.

      Specified by:
      fields in class TextFormat
    • inject

      public <C> void inject(SpanContext spanContext, C carrier, TextFormat.Setter<C> setter)
      Description copied from class: TextFormat
      Injects the span context downstream. For example, as http headers.
      Specified by:
      inject in class TextFormat
      Parameters:
      spanContext - possibly not sampled.
      carrier - holds propagation fields. For example, an outgoing message or http request.
      setter - invoked for each propagation key to add or remove.
    • extract

      public <C> SpanContext extract(C carrier, TextFormat.Getter<C> getter) throws SpanContextParseException
      Description copied from class: TextFormat
      Extracts the span context from upstream. For example, as http headers.
      Specified by:
      extract in class TextFormat
      Parameters:
      carrier - holds propagation fields. For example, an outgoing message or http request.
      getter - invoked for each propagation key to get.
      Throws:
      SpanContextParseException - if the input is invalid