feat: enhance tracing system with OpenTelemetry semantic conventions - #1331
Merged
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
approved these changes
Aug 20, 2025
cparisien
left a comment
Collaborator
There was a problem hiding this comment.
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
approved these changes
Aug 21, 2025
tgasser-nv
left a comment
Collaborator
There was a problem hiding this comment.
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
Pouyanpi
force-pushed
the
feat/otel-semantic-conventions
branch
from
August 22, 2025 06:47
37a1bed to
be51f33
Compare
Pouyanpi
added a commit
that referenced
this pull request
Oct 1, 2025
…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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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