-
Notifications
You must be signed in to change notification settings - Fork 560
UN-2830 [MISC] Suppress OpenTelemetry EventLogger deprecation warning in prompt-service #1585
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
UN-2830 [MISC] Suppress OpenTelemetry EventLogger deprecation warning in prompt-service #1585
Conversation
…ing in prompt-service Suppressed the LogDeprecatedInitWarning from OpenTelemetry SDK 1.37.0's EventLogger.emit() method which still uses deprecated trace_id/span_id/trace_flags parameters instead of the context parameter. This is a temporary workaround for an upstream bug in OpenTelemetry Python SDK where EventLogger.emit() was not updated when LogRecord API was changed to accept context parameter. The warning only appears in prompt-service because llama-index emits OpenTelemetry Events. See: open-telemetry/opentelemetry-python#4328 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Summary by CodeRabbit
WalkthroughAdds a warning suppression for an OpenTelemetry EventLogger deprecation warning in the application initialization flow by importing warnings and calling warnings.filterwarnings after setup_logging within create_app. No functional changes or API/signature modifications. Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 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.
Actionable comments posted: 0
🧹 Nitpick comments (1)
prompt-service/src/unstract/prompt_service/config.py (1)
27-37: Well-documented temporary suppression for upstream issue.The warning suppression is appropriately narrow with good documentation. The approach is sound for handling this known OpenTelemetry SDK bug until it's fixed upstream.
Optional: Use raw string for regex pattern.
Consider using a raw string literal for the regex pattern to follow Python best practices:
warnings.filterwarnings( "ignore", - message="LogRecord init with.*trace_id.*span_id.*trace_flags.*deprecated", + message=r"LogRecord init with.*trace_id.*span_id.*trace_flags.*deprecated", category=DeprecationWarning, module="opentelemetry.sdk._events", )While not critical here (no backslashes in the pattern), raw strings are the idiomatic choice for regex patterns and prevent potential escaping issues.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Cache: Disabled due to Reviews > Disable Cache setting
Knowledge base: Disabled due to Reviews -> Disable Knowledge Base setting
📒 Files selected for processing (1)
prompt-service/src/unstract/prompt_service/config.py(2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: build
🔇 Additional comments (1)
prompt-service/src/unstract/prompt_service/config.py (1)
2-2: LGTM!Standard library import correctly placed and necessary for the warning suppression below.
Test ResultsSummary
Runner Tests - Full Report
SDK1 Tests - Full Report
|
|
… in prompt-service (#1585) UN-2830 Suppress OpenTelemetry EventLogger LogRecord deprecation warning in prompt-service Suppressed the LogDeprecatedInitWarning from OpenTelemetry SDK 1.37.0's EventLogger.emit() method which still uses deprecated trace_id/span_id/trace_flags parameters instead of the context parameter. This is a temporary workaround for an upstream bug in OpenTelemetry Python SDK where EventLogger.emit() was not updated when LogRecord API was changed to accept context parameter. The warning only appears in prompt-service because llama-index emits OpenTelemetry Events. See: open-telemetry/opentelemetry-python#4328 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude <noreply@anthropic.com>
… in prompt-service (#1585) UN-2830 Suppress OpenTelemetry EventLogger LogRecord deprecation warning in prompt-service Suppressed the LogDeprecatedInitWarning from OpenTelemetry SDK 1.37.0's EventLogger.emit() method which still uses deprecated trace_id/span_id/trace_flags parameters instead of the context parameter. This is a temporary workaround for an upstream bug in OpenTelemetry Python SDK where EventLogger.emit() was not updated when LogRecord API was changed to accept context parameter. The warning only appears in prompt-service because llama-index emits OpenTelemetry Events. See: open-telemetry/opentelemetry-python#4328 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude <noreply@anthropic.com>



What
LogDeprecatedInitWarningdeprecation warning from OpenTelemetry SDK 1.37.0 that was appearing in prompt-service logsopentelemetry.sdk._eventsmoduleWhy
EventLogger.emit()still uses the deprecatedtrace_id,span_id, andtrace_flagsparameters instead of the newcontextparameter when creating LogRecord instancesHow
import warningstoprompt-service/src/unstract/prompt_service/config.pywarnings.filterwarnings()call increate_app()function that:opentelemetry.sdk._eventsmoduleCan this PR break any existing features. If yes, please list possible items. If no, please explain why. (PS: Admins do not merge the PR without this section filled)
Database Migrations
Env Config
Relevant Docs
.prompting/plan/UN-2830/implementation-2025-10-13-2103.mdRelated Issues or PRs
Dependencies Versions
opentelemetry-sdk==1.37.0(current version in use)Notes on Testing
To verify the fix:
Screenshots
N/A - This is a log warning suppression fix with no UI changes
Checklist
.prompting/plan/UN-2830/