-
Hi! I'm trying to understand how to add an attribute to all spans in a trace. As I understand it this is sometimes called "correlation context". I've tried using |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Baggage does not automatically add attributes to spans in a trace. It can propagate "correlation context" but that's not its only use. Typically, the easiest ways to add attributes to all spans are using a opentelemetry-ruby/sdk/lib/opentelemetry/sdk/trace/span_processor.rb Lines 15 to 33 in 113e513 or using a Sampler , which can return attributes to be added to a span alongside the sampling decision: opentelemetry-ruby/sdk/lib/opentelemetry/sdk/trace/samplers.rb Lines 20 to 39 in 113e513 |
Beta Was this translation helpful? Give feedback.
Baggage does not automatically add attributes to spans in a trace. It can propagate "correlation context" but that's not its only use.
Typically, the easiest ways to add attributes to all spans are using a
SpanProcessor
, which receiveson_start
andon_finish
callbacks:opentelemetry-ruby/sdk/lib/opentelemetry/sdk/trace/span_processor.rb
Lines 15 to 33 in 113e513