-
Notifications
You must be signed in to change notification settings - Fork 563
feat: enhance tracing system with OpenTelemetry semantic conventions #1331
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## develop #1331 +/- ##
===========================================
+ Coverage 71.04% 71.59% +0.54%
===========================================
Files 162 168 +6
Lines 16398 16861 +463
===========================================
+ Hits 11650 12071 +421
- Misses 4748 4790 +42
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
cparisien
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm good with this. I reviewed it from the perspective of understanding what we're doing and that it lines up with expectations. Tim is going into more depth on OTel and testing via Jaeger, I'll leave that to him.
tgasser-nv
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! I have a couple of high-level questions.
- Are we restricted to only instrumenting LLM calls (do we do the same for API calls to third-party integration APIs?)
- The Gen AI Opentelemetry definitions are in development phase (pre-alpha). Is there any way to keep our definitions in sync with them over time? Or we just need to re-check every time we bump the Open Telemetry library.
- Do you have any rough idea the load of logging telemetry like this (i.e. how much CPU does it consume?)
…and configurable span formats Introduces a major enhancement to the NeMo Guardrails tracing and telemetry infrastructure with support for multiple span formats, OpenTelemetry semantic convention compliance, and privacy-focused content capture controls. The system now supports both flat (legacy) and OpenTelemetry-compliant span formats while maintaining backward compatibility. Key changes: - Add configurable span format support (flat/opentelemetry) - Implement OpenTelemetry semantic conventions for GenAI - Add privacy controls for prompt/response content capture - Enhance LLM call tracking with model provider information - Improve span extraction and modeling architecture - Add comprehensive test coverage for new functionality
- Replace isinstance(span, TypedSpan) with explicit tuple of types - TypedSpan is a Union type which cannot be used with isinstance in Python 3.9 - Update test to check for specific LLMSpan type instead of Union - Fixes TypeError: Subscripted generics cannot be used with class and instance checks
37a1bed to
be51f33
Compare
…1331) * feat: enhance tracing system with OpenTelemetry semantic conventions and configurable span formats Introduces a major enhancement to the NeMo Guardrails tracing and telemetry infrastructure with support for multiple span formats, OpenTelemetry semantic convention compliance, and privacy-focused content capture controls. The system now supports both legacy and OpenTelemetry-compliant span formats while maintaining backward compatibility. Key changes: - Add configurable span format support (flat/opentelemetry) - Implement OpenTelemetry semantic conventions for GenAI - Add privacy controls for prompt/response content capture - Enhance LLM call tracking with model provider information - Improve span extraction and modeling architecture - Add comprehensive test coverage for new functionality
PR Description
This PR introduces a comprehensive enhancement to the NeMo Guardrails tracing and telemetry infrastructure, providing improved observability, standardized telemetry formats, and privacy controls for production deployments.
Screenshots
Nemoguard NIMs with parallel input rails:
Example of Span attributes
High-Level Impact
Strategic Goals
Key Features
1. Configurable Span Formats
span_formatfield in TracingConfig2. Privacy First Content Capture
enable_content_captureflag to control prompt/response recording3. Enhanced LLM Provider Tracking
model_nameandmodel_providerparameters to LLM callsTechnical Implementation
Architecture Changes
New Core Components
SpanFormatEnum: Type-safe span format definitionsSpanExtractorHierarchy: V1 (legacy) and V2 (OTel) extractorsEnhanced Components
Data Flow
OpenTelemetry Semantic Conventions
Implements GenAI semantic conventions including:
gen_ai.request.modelgen_ai.request.max_tokensgen_ai.response.finish_reasonsgen_ai.usage.input_tokensgen_ai.usage.output_tokensguardrails.*namespaceBreaking Changes
None - Full backward compatibility maintained
Migration Guide
Existing deployments will continue to work without changes. To adopt new features:
Testing