nemoguardrails.tracing.adapters.opentelemetry
OpenTelemetry Adapter for NeMo Guardrails
This adapter follows OpenTelemetry best practices for libraries:
- Uses only the OpenTelemetry API (not SDK)
- Does not modify global state
- Relies on the application to configure the SDK
Module Contents
Classes
Functions
API
Bases: InteractionLogAdapter
OpenTelemetry adapter that follows library best practices.
This adapter uses only the OpenTelemetry API and relies on the application to configure the SDK. It does not modify global state or create its own tracer provider.
Create OTel span from a span.
This is a pure API bridge - all semantic attributes are extracted by the formatting function. We only handle:
- Timestamp conversion (relative to absolute)
- Span kind mapping (string to enum)
- API calls to create spans and events
Transforms the InteractionLog into OpenTelemetry spans.
Transforms the InteractionLog into OpenTelemetry spans asynchronously.
Get the base time in nanoseconds for tracing spans.
Parameters:
The interaction log containing rail timing information
Returns: int
Base time in nanoseconds, either from the first activated rail or current time