Class TextMapPropagator
- Namespace
- OpenTelemetry.Context.Propagation
- Assembly
- OpenTelemetry.Api.dll
Defines an interface for a Propagator of TextMap type, which uses string key/value pairs to inject and extract propagation data.
public abstract class TextMapPropagator
- Inheritance
-
TextMapPropagator
- Derived
- Inherited Members
Constructors
TextMapPropagator()
protected TextMapPropagator()
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 abstract ISet<string> Fields { get; }
Property Value
Methods
Extract<T>(PropagationContext, T, Func<T, string, IEnumerable<string>>)
Extracts the context from a carrier.
public abstract PropagationContext Extract<T>(PropagationContext context, T carrier, Func<T, string, IEnumerable<string>> getter)
Parameters
context
PropagationContextThe default context to be used if Extract fails.
carrier
TObject 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 abstract void Inject<T>(PropagationContext context, T carrier, Action<T, string, string> setter)
Parameters
context
PropagationContextThe default context to transmit over the wire.
carrier
TObject 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.