span_processor Module

Span processor for propagating OpenTelemetry baggage entries onto spans.

Vendored from microsoft-agents-a365-observability-core trace_processor/span_processor.py and trace_processor/util.py.

For every new span:

  • Retrieve the current (or parent) context
  • Obtain all baggage entries
  • For each documented key with a truthy value not already present as a span attribute, add it via span.set_attribute
  • Never overwrites existing attributes

Classes

A365SpanProcessor

Span processor that stamps agent identity and propagates baggage to span attributes.

Static identity (tenant_id, agent_id) is set from configuration on every span. Additional baggage entries are propagated selectively for documented keys. Never overwrites existing attributes.