<PackageReference Include="OpenTelemetry.Api" Version="1.15.2" />

OpenTelemetry.Baggage

public struct Baggage : IEquatable<Baggage>
Baggage implementation.
public static Baggage Current { get; set; }

Gets or sets the current Baggage.

public int Count { get; }

Gets the number of key/value pairs in the baggage.

public static Baggage ClearBaggage(Baggage baggage = default)

Returns a new Baggage with all the key/value pairs removed.

public static Baggage Create(Dictionary<string, string> baggageItems = null)

Create a Baggage instance from dictionary of baggage key/value pairs.

public static IReadOnlyDictionary<string, string> GetBaggage(Baggage baggage = default)

Returns the name/value pairs in the Baggage.

public static string GetBaggage(string name, Baggage baggage = default)

Returns the value associated with the given name, or null if the given name is not present.

public static Enumerator<string, string> GetEnumerator(Baggage baggage = default)

Returns an enumerator that iterates through the Baggage.

public static bool op_Equality(Baggage left, Baggage right)

Compare two entries of Baggage for equality.

public static bool op_Inequality(Baggage left, Baggage right)

Compare two entries of Baggage for not equality.

public static Baggage RemoveBaggage(string name, Baggage baggage = default)

Returns a new Baggage with the key/value pair removed.

public static Baggage SetBaggage(string name, string value, Baggage baggage = default)

Returns a new Baggage which contains the new key/value pair.

public static Baggage SetBaggage(IEnumerable<KeyValuePair<string, string>> baggageItems, Baggage baggage = default)

Returns a new Baggage which contains the new key/value pairs.

Returns a new Baggage with all the key/value pairs removed.

public bool Equals(Baggage other)

public IReadOnlyDictionary<string, string> GetBaggage()

Returns the name/value pairs in the Baggage.

public string GetBaggage(string name)

Returns the value associated with the given name, or null if the given name is not present.

public Enumerator<string, string> GetEnumerator()

Returns an enumerator that iterates through the Baggage.

public Baggage RemoveBaggage(string name)

Returns a new Baggage with the key/value pair removed.

public Baggage SetBaggage(string name, string value)

Returns a new Baggage which contains the new key/value pair.

public Baggage SetBaggage(KeyValuePair<string, string>[] baggageItems)

Returns a new Baggage which contains the new key/value pairs.

public Baggage SetBaggage(IEnumerable<KeyValuePair<string, string>> baggageItems)

Returns a new Baggage which contains the new key/value pairs.