-
Notifications
You must be signed in to change notification settings - Fork 558
feat(tracing)!: update tracing to use otel api #1269
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 ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #1269 +/- ##
===========================================
+ Coverage 69.78% 70.13% +0.34%
===========================================
Files 161 161
Lines 16057 16037 -20
===========================================
+ Hits 11206 11248 +42
+ Misses 4851 4789 -62
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
Documentation preview |
73d11fc to
6609cf2
Compare
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.
Pull Request Overview
This PR refactors the OpenTelemetry integration to depend only on the API (no SDK), adds deprecation warnings for legacy config parameters, validates runtime configuration, updates tests, and refreshes documentation and examples.
- Switched the adapter to use only
opentelemetry-apiand removed SDK setup from the library - Introduced deprecation warnings and runtime checks for old tracing configuration
- Updated tests, examples, and documentation to reflect API-only usage
Reviewed Changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/test_tracing_adapters_opentelemetry.py | Adjusted tests for API-only adapter, added deprecation and warning tests |
| pyproject.toml | Removed SDK from tracing extras; added API/SDK under docs group |
| nemoguardrails/tracing/adapters/opentelemetry.py | Refactored adapter to use only API, added deprecation and validation |
| examples/configs/tracing/working_example.py | New example script demonstrating proper OpenTelemetry setup |
| examples/configs/tracing/README.md | Expanded documentation, quickstart, migration guide, and examples |
Comments suppressed due to low confidence (1)
nemoguardrails/tracing/adapters/opentelemetry.py:96
- The deprecation warning URL points to the
developbranch, while other links usemain. Align the branch in this link tomainto avoid confusion for users browsing the default branch.
"https://github.com/NVIDIA/NeMo-Guardrails/blob/develop/examples/configs/tracing/README.md#migration-guide",
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.
LGTM ! Could you try out the JSON file-logging locally to check everything works before merging?
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.
Refactored the OpenTelemetry tracing adapter to follow OpenTelemetry library best practices. The adapter now uses only the OpenTelemetry API, does not modify global state, and relies on the application to configure the SDK and tracer provider. Removed legacy exporter and span processor configuration from the adapter. Updated tests to reflect the new initialization logic and ensure backward compatibility with old config parameters.
Co-authored-by: Copilot <[email protected]> Signed-off-by: Pouyan <[email protected]>
573a67d to
873d654
Compare
|
Note We need to update the documentation about the changes to tracing feature
|
* feat(tracing)!: migrate OpenTelemetry adapter to use otel API Refactored the OpenTelemetry tracing adapter to follow OpenTelemetry library best practices. The adapter now uses only the OpenTelemetry API, does not modify global state, and relies on the application to configure the SDK and tracer provider. Removed legacy exporter and span processor configuration from the adapter. Updated tests to reflect the new initialization logic and ensure backward compatibility with old config parameters. Signed-off-by: Pouyan <[email protected]> Add handling for config directory with .yml/.yaml extension Fixes `config.yml/` directory being accepted as a valid path and attempted to open as a file, resulting in a `ENOPERM` Signed-off-by: Arthur Bied-Charreton <[email protected]> Add test config with .yml extension Add test verifying that general.yml/ is interpreted as a directory Run pre-commit Simplify condition in `from_path` Add test config with .yml extension Add test verifying that general.yml/ is interpreted as a directory Simplify condition in `from_path` Add test config with .yml extension Add test verifying that general.yml/ is interpreted as a directory Simplify condition in `from_path`
* feat(tracing)!: migrate OpenTelemetry adapter to use otel API Refactored the OpenTelemetry tracing adapter to follow OpenTelemetry library best practices. The adapter now uses only the OpenTelemetry API, does not modify global state, and relies on the application to configure the SDK and tracer provider. Removed legacy exporter and span processor configuration from the adapter. Updated tests to reflect the new initialization logic and ensure backward compatibility with old config parameters. Signed-off-by: Pouyan <[email protected]> Add handling for config directory with .yml/.yaml extension Fixes `config.yml/` directory being accepted as a valid path and attempted to open as a file, resulting in a `ENOPERM` Signed-off-by: Arthur Bied-Charreton <[email protected]> Add test config with .yml extension Add test verifying that general.yml/ is interpreted as a directory Run pre-commit Simplify condition in `from_path` Add test config with .yml extension Add test verifying that general.yml/ is interpreted as a directory Simplify condition in `from_path` Add test config with .yml extension Add test verifying that general.yml/ is interpreted as a directory Simplify condition in `from_path` Add test config with .yml extension Add test verifying that general.yml/ is interpreted as a directory Simplify condition in `from_path` Add test config with .yml extension Add test verifying that general.yml/ is interpreted as a directory Simplify condition in `from_path` Add test config with .yml extension Add test verifying that general.yml/ is interpreted as a directory Simplify condition in `from_path`
* feat(tracing)!: migrate OpenTelemetry adapter to use otel API Refactored the OpenTelemetry tracing adapter to follow OpenTelemetry library best practices. The adapter now uses only the OpenTelemetry API, does not modify global state, and relies on the application to configure the SDK and tracer provider. Removed legacy exporter and span processor configuration from the adapter. Updated tests to reflect the new initialization logic and ensure backward compatibility with old config parameters. Signed-off-by: Pouyan <[email protected]>
Description
This PR refactors the OpenTelemetry integration to follow OpenTelemetry best practices by removing the SDK dependency and relying only on the OpenTelemetry API. We should not configure observability; that's the application's responsibility.
Changes
opentelemetry-sdkfrom[tracing]extra dependenciesexporter,resource_attributes, etc.)register_otel_exporterfunction with deprecation warning (will be removed in v0.16.0)Fixes
Resolves #1094