nemoguardrails.llm.telemetry
Module Contents
Functions
Data
API
Create a GenAI client span for one LLM call.
Yields None when no tracer is configured. Provider exceptions from the
wrapped call are recorded on the span and re-raised unchanged. Early stream
closure (GeneratorExit) and task cancellation (CancelledError) are
control flow, not provider failures, so they are re-raised without marking
the span as an error.
Record error status and the exception type on a span.
The exception message and stack trace are deliberately omitted: a provider error can embed request content, which must not reach telemetry unless content capture is explicitly enabled. Only the low-cardinality error type is recorded.
Record LLM input and output content on a span when available.
The configured OpenTelemetry content format determines whether content is stored as JSON attributes or legacy events. Telemetry failures are ignored so they cannot affect the model call.
Record supported GenAI request parameters on a span.
Unknown parameters are ignored, as are telemetry failures.
Record available model response metadata and token usage on a span.