Table of Contents

Class BaggagePropagator

Namespace
OpenTelemetry.Context.Propagation
Assembly
OpenTelemetry.Api.dll

A text map propagator for W3C Baggage. See https://w3c.github.io/baggage/.

public class BaggagePropagator : TextMapPropagator
Inheritance
BaggagePropagator
Inherited Members

Constructors

BaggagePropagator()

public BaggagePropagator()

Properties

Fields

Gets the list of headers used by propagator. The use cases of this are:

  • allow pre-allocation of fields, especially in systems like gRPC Metadata
  • allow a single-pass over an iterator (ex OpenTracing has no getter in TextMap).
public override ISet<string> Fields { get; }

Property Value

ISet<string>

Methods

Extract<T>(PropagationContext, T, Func<T, string, IEnumerable<string>>)

Extracts the context from a carrier.

public override PropagationContext Extract<T>(PropagationContext context, T carrier, Func<T, string, IEnumerable<string>> getter)

Parameters

context PropagationContext

The default context to be used if Extract fails.

carrier T

Object to extract context from. Instance of this object will be passed to the getter.

getter Func<T, string, IEnumerable<string>>

Function that will return string value of a key with the specified name.

Returns

PropagationContext

Context from it's text representation.

Type Parameters

T

Type of object to extract context from. Typically HttpRequest or similar.

Inject<T>(PropagationContext, T, Action<T, string, string>)

Injects the context into a carrier.

public override void Inject<T>(PropagationContext context, T carrier, Action<T, string, string> setter)

Parameters

context PropagationContext

The default context to transmit over the wire.

carrier T

Object to set context on. Instance of this object will be passed to setter.

setter Action<T, string, string>

Action that will set name and value pair on the object.

Type Parameters

T

Type of an object to set context on. Typically HttpRequest or similar.