feat(config): wire top-level log_level field in declarative configuration#5351
Open
ocelotl wants to merge 3 commits into
Open
feat(config): wire top-level log_level field in declarative configuration#5351ocelotl wants to merge 3 commits into
ocelotl wants to merge 3 commits into
Conversation
ocelotl
added a commit
to ocelotl/opentelemetry-python
that referenced
this pull request
Jun 25, 2026
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
MikeGoldsmith
left a comment
Member
There was a problem hiding this comment.
Generally looks pretty good. I've left one suggestion regarding default level.
Map the top-level `log_level` field from declarative configuration to the `opentelemetry` root logger level so SDK internal diagnostics respect the configured severity.
Co-authored-by: Mike Goldsmith <goldsmith.mike@gmail.com>
97cc820 to
e64f998
Compare
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.
Description
The declarative configuration schema has a top-level
log_levelfield that controls the SDK's internal diagnostic logging verbosity. It was parsed and validated by the schema loader but never read byconfigure_sdk— so setting it in a config file had no observable effect.This PR wires
log_levelintoconfigure_sdk: when the field is present, it maps the OTelSeverityNumbervalue to a Pythonlogginglevel and sets it on theopentelemetryroot logger. All numbered severity variants (e.g.debug2,warn3) collapse to the same Python tier.Mapping:
trace,trace2–4DEBUGdebug,debug2–4DEBUGinfo,info2–4INFOwarn,warn2–4WARNINGerror,error2–4ERRORfatal,fatal2–4CRITICALWhen
log_levelis absent the logger is untouched, preserving existing behaviour.Fixes the gap noted in #5347 (
log_level ❌ — No tracker yet).Type of change
How Has This Been Tested?
Three new unit tests in
test_sdk.py:test_sets_opentelemetry_logger_level— verifies a specific severity sets the expected leveltest_absent_log_level_leaves_logger_unchanged— verifies no mutation when field is absenttest_severity_number_variants_map_correctly— exhaustive subTest over all tiers (trace, debug, info, warn, error, fatal + their*4variants)Does This PR Require a Contrib Repo Change?
Checklist
🤖 Generated with Claude Code