setBaggageItem method

void setBaggageItem(
  1. String key,
  2. dynamic value
)

Sets a key:value pair on this SpanContext that also propagates to future children of the associated Span.

setBaggageItem() enables powerful functionality given a full-stack opentracing integration (e.g., arbitrary application data from a web client can make it, transparently, all the way into the depths of a storage system), and with it some powerful costs: use this feature with care.

IMPORTANT NOTE #1: setBaggageItem() will only propagate baggage items to future causal descendants of the associated Span.

IMPORTANT NOTE #2: Use this thoughtfully and with care. Every key and value is copied into every local and remote child of the associated Span, and that can add up to a lot of network and cpu overhead.

Implementation

void setBaggageItem(String key, dynamic value) {
  _baggage[key] = value;
}