-
Notifications
You must be signed in to change notification settings - Fork 523
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
Open
Pouyanpi
wants to merge
5
commits into
develop
Choose a base branch
from
feat/otel-semantic-conventions
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
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
…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
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## develop #1331 +/- ##
===========================================
+ Coverage 70.58% 71.09% +0.50%
===========================================
Files 161 166 +5
Lines 16291 16722 +431
===========================================
+ Hits 11499 11888 +389
- Misses 4792 4834 +42
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
- 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
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.
High-Level Impact
Strategic Goals
Key Features
1. Configurable Span Formats
span_format
field in TracingConfig2. Privacy First Content Capture
enable_content_capture
flag to control prompt/response recording3. Enhanced LLM Provider Tracking
model_name
andmodel_provider
parameters to LLM callsTechnical Implementation
Architecture Changes
New Core Components
SpanFormat
Enum: Type-safe span format definitionsSpanExtractor
Hierarchy: V1 (flat) and V2 (OTel) extractorsEnhanced Components
Data Flow
OpenTelemetry Semantic Conventions
Implements GenAI semantic conventions including:
gen_ai.request.model
gen_ai.request.max_tokens
gen_ai.response.finish_reasons
gen_ai.usage.input_tokens
gen_ai.usage.output_tokens
guardrails.*
namespaceBreaking Changes
None - Full backward compatibility maintained
Migration Guide
Existing deployments will continue to work without changes. To adopt new features:
Testing