nemoguardrails.tracing.span_extractors
nemoguardrails.tracing.span_extractors
Span extraction logic for different span versions.
Module Contents
Classes
Functions
API
Base class for span extractors.
Extract spans from activated rails.
Bases: SpanExtractor
Extract v2 spans with OpenTelemetry semantic conventions.
Extract guardrails-specific conversation events from internal events.
NOTE: These are NeMo Guardrails internal events, NOT OpenTelemetry GenAI events. We use guardrails-specific namespacing to avoid confusion with OTel GenAI semantic conventions.
Extract finish reasons from raw LLM response.
Extract OpenTelemetry GenAI message events from an LLM call.
Extract timestamp from event or use reference time.
Parameters:
The internal event dictionary
Reference time to use as fallback (trace start time)
Returns: float
Timestamp in seconds relative to trace start
Extract v2 spans from activated rails with OpenTelemetry attributes.
Create a span extractor based on format and configuration.
Parameters:
Format of span extractor (‘legacy’ or ‘opentelemetry’)
Internal events for OpenTelemetry extractor
Whether to capture content in spans
Returns: SpanExtractor
Configured span extractor instance
Raises:
ValueError: If span_format is not supported