Class BaggagePropagationOptions
Controls which W3C baggage entries are copied from the ambient activity into a message context, and how much of them.
public sealed class BaggagePropagationOptions
- Inheritance
-
BaggagePropagationOptions
- Inherited Members
- Extension Methods
Remarks
Nothing is copied unless you name it. Baggage arrives from outside the process — the
runtime parses the inbound baggage header into the ambient activity without being asked — so its
keys and values are chosen by whoever made the request, not by the application. Copying them into a
message context puts them on the wire for remote transports and into the logs, telemetry and stores of
every service downstream. The entries worth carrying are few and known, so they are opted in by name.
The caps are not the allowlist, and neither one covers the other. An allowlist keeps untrusted values out of trusted sinks; it does nothing about size, because a permitted key can carry a large value. The caps bound amplification — one cheap request riding every downstream message — and do nothing about trust. Both apply.
Properties
AllowedKeys
Gets the baggage keys that may be copied into a message context.
public ISet<string> AllowedKeys { get; }
Property Value
- ISet<string>
The permitted keys, compared with the ordinal comparer. Empty by default, which copies nothing.
Remarks
A key is matched exactly, without the baggage. prefix the context item receives. Comparison is
ordinal and case-sensitive because baggage keys are transmitted verbatim and two keys differing only in
case are two different keys to every other participant in the trace.
MaxEntries
Gets or sets the maximum number of baggage entries copied into a single message context.
public int MaxEntries { get; set; }
Property Value
- int
The entry cap. Defaults to
8. Must be greater than zero.
Remarks
Entries beyond the cap are dropped rather than truncated, so a context never carries a partial value. The cap applies after the allowlist, so it bounds what a permitted key can do rather than substituting for the decision about which keys are permitted at all.
MaxTotalLength
Gets or sets the maximum combined length, in characters, of all copied keys and values.
public int MaxTotalLength { get; set; }
Property Value
- int
The total cap. Defaults to
1024. Must be greater than zero.
Remarks
Reached before the entry cap when a few permitted keys carry large values, which is the shape the entry cap alone does not bound.
MaxValueLength
Gets or sets the maximum length, in characters, of a single copied baggage value.
public int MaxValueLength { get; set; }
Property Value
- int
The per-value cap. Defaults to
256. Must be greater than zero.
Remarks
A value longer than this is dropped, not trimmed. A trimmed value is still a value: it would be read downstream as though it were the whole thing, and a correlation identifier cut in half is worse than an absent one because nothing downstream can tell that it is incomplete.