microsoft.opentelemetry.a365.core.exporters.span_processor module

Propagate A365 identity and baggage to recognized GenAI spans.

Existing span attributes are never overwritten.

class microsoft.opentelemetry.a365.core.exporters.span_processor.A365SpanProcessor(tenant_id=None, agent_id=None)[source]

Bases: SpanProcessor

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

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

on_start(span, parent_context=None)[source]

Called when a opentelemetry.trace.Span is started.

This method is called synchronously on the thread that starts the span, therefore it should not block or throw an exception.

Parameters:
  • span – The opentelemetry.trace.Span that just started.

  • parent_context – The parent context of the span that just started.

on_end(span)[source]

Called when a opentelemetry.trace.Span is ended.

This method is called synchronously on the thread that ends the span, therefore it should not block or throw an exception.

Parameters:

span – The opentelemetry.trace.Span that just ended.