microsoft.opentelemetry.a365.core.exporters.enriched_span module

Enriched ReadableSpan wrapper for adding attributes to immutable spans.

Vendored from microsoft-agents-a365-observability-core exporters/enriched_span.py.

class microsoft.opentelemetry.a365.core.exporters.enriched_span.EnrichedReadableSpan(span, extra_attributes, excluded_attribute_keys=None)[source]

Bases: ReadableSpan

Wrapper to add attributes to an immutable ReadableSpan.

Since ReadableSpan is immutable after a span ends, this wrapper allows extensions to add additional attributes before export without modifying the original span.

property attributes: Mapping[str, str | bool | int | float | Sequence[str] | Sequence[bool] | Sequence[int] | Sequence[float]] | None

Return merged attributes from original span and extra attributes.

property name
property context
property parent
property start_time
property end_time
property status
property kind
property events
property resource
property instrumentation_scope
to_json(indent=4)[source]

Convert span to JSON string with enriched attributes.

Parameters:

indent (int | None) – JSON indentation level.

Return type:

str

Returns:

JSON string representation of the span.