<PackageReference Include="System.Diagnostics.DiagnosticSource" Version="6.0.2" />

DistributedContextPropagator

public abstract class DistributedContextPropagator
An implementation of DistributedContextPropagator determines if and how distributed context information is encoded and decoded as it traverses the network. The encoding can be transported over any network protocol that supports string key-value pairs. For example when using HTTP, each key value pair is an HTTP header. DistributedContextPropagator inject values into and extracts values from carriers as string key/value pairs.

The callback that is used in propagators' extract methods. The callback is invoked to lookup the value of a named field.

The callback that is used in propagators' inject methods. This callback is invoked to set the value of a named field. Propagators may invoke it multiple times in order to set multiple fields.

public static DistributedContextPropagator Current { get; set; }

Get or set the process wide propagator object which used as the current selected propagator.

public abstract IReadOnlyCollection<string> Fields { get; }

The set of field names this propagator is likely to read or write.

returns the default propagator object which Current property will be initialized with.

Returns a propagator which does not transmit any distributed context information in outbound network messages.

Returns a propagator which attempts to act transparently, emitting the same data on outbound network requests that was received on the in-bound request. When encoding the outbound message, this propagator uses information from the request's root Activity, ignoring any intermediate Activities that may have been created while processing the request.

public abstract IEnumerable<KeyValuePair<string, string>> ExtractBaggage(object carrier, PropagatorGetterCallback getter)

Extracts the baggage key-value pair list from an incoming request represented by the carrier. For example, from the headers of an HTTP request.

public abstract void ExtractTraceIdAndState(object carrier, PropagatorGetterCallback getter, out string traceId, out string traceState)

Extracts trace Id and trace state from an incoming request represented by the carrier. For example, from the headers of an HTTP request.

public abstract void Inject(Activity activity, object carrier, PropagatorSetterCallback setter)

Injects the trace values stroed in the Activity object into a carrier. For example, into the headers of an HTTP request.