-
Notifications
You must be signed in to change notification settings - Fork 78
Description
Imported old issue.
Generally this is a way to "carry" context across actors, we'll want this to play well with the GSOC ideas around tracing and propagation
We need a way to propagate: tracer bullets, events for metrics, MDC logger metadata as well as trace information.
In some systems this is often called Baggage; I.e. open tracing calls it that: https://medium.com/jaegertracing/embracing-context-propagation-7100b9b6029a
Open questions: do we also set a ref to the current actors baggage into a thread local or similar, or we don't? We have to if we want to allow ref.tell() to work with propagation; if we do not, then users would have to remember to do context.tell(who, what) which may be a hassle and worse, easy to forget and break a trace this day (that's catastrophic!). We may offer context.tell if we wanted to anyway since it could avoid the threadlocal so in hot code people could use that rather than the direct one? though either would work.
References:
- https://medium.com/jaegertracing/embracing-context-propagation-7100b9b6029a
- https://medium.com/jaegertracing/istio-routing-using-opentracing-baggage-distributed-context-propagation-ed8d787a4bef
// SetBaggageItem sets a key:value pair on this Span and its SpanContext
// that also propagates to descendants of this Span.
//
// SetBaggageItem() enables powerful functionality given a full-stack
// opentracing integration (e.g., arbitrary application data from a mobile
// app 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.
//
// Returns a reference to this Span for chaining.
SetBaggageItem(restrictedKey, value string) Span
Work here also relates to the Swift "context propagation" story so we should be in the loop on similar effrots so the same mechanism can be used in more places. It COULD mean addopting open tracing's ideas or making our own and standardizing.
Alternatively, if we want to avoid using the same name as OpenTracing does we could use the word Luggage and also sound very british while doing so 😉