Skip to content

feat(config): wire top-level log_level field in declarative configuration#5351

Draft
ocelotl wants to merge 2 commits into
open-telemetry:mainfrom
ocelotl:diego/config-log-level-wiring
Draft

feat(config): wire top-level log_level field in declarative configuration#5351
ocelotl wants to merge 2 commits into
open-telemetry:mainfrom
ocelotl:diego/config-log-level-wiring

Conversation

@ocelotl

@ocelotl ocelotl commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Description

The declarative configuration schema has a top-level log_level field that controls the SDK's internal diagnostic logging verbosity. It was parsed and validated by the schema loader but never read by configure_sdk — so setting it in a config file had no observable effect.

This PR wires log_level into configure_sdk: when the field is present, it maps the OTel SeverityNumber value to a Python logging level and sets it on the opentelemetry root logger. All numbered severity variants (e.g. debug2, warn3) collapse to the same Python tier.

Mapping:

OTel severity Python level
trace, trace2–4 DEBUG
debug, debug2–4 DEBUG
info, info2–4 INFO
warn, warn2–4 WARNING
error, error2–4 ERROR
fatal, fatal2–4 CRITICAL

When log_level is absent the logger is untouched, preserving existing behaviour.

Fixes the gap noted in #5347 (log_level ❌ — No tracker yet).

Type of change

  • Bug fix / gap closure (non-breaking change that makes existing behaviour match the spec)

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 level
  • test_absent_log_level_leaves_logger_unchanged — verifies no mutation when field is absent
  • test_severity_number_variants_map_correctly — exhaustive subTest over all tiers (trace, debug, info, warn, error, fatal + their *4 variants)

Does This PR Require a Contrib Repo Change?

  • Yes.
  • No.

Checklist

  • Followed the style guidelines of this project
  • Changelogs have been updated (will add once PR number is known)
  • Unit tests have been added
  • Documentation has been updated (spec-conformance.md row will change from ❌ to ✅)

🤖 Generated with Claude Code

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: Claude Sonnet 4.6 <noreply@anthropic.com>
@ocelotl ocelotl requested a review from a team as a code owner June 25, 2026 01:08
@linux-foundation-easycla

linux-foundation-easycla Bot commented Jun 25, 2026

Copy link
Copy Markdown

CLA Missing ID

One or more co-authors of this pull request were not found. You must specify co-authors in commit message trailer via:

Co-authored-by: name <email>

Supported Co-authored-by: formats include:

  1. Anything <id+login@users.noreply.github.com> - it will locate your GitHub user by id part.
  2. Anything <login@users.noreply.github.com> - it will locate your GitHub user by login part.
  3. Anything <public-email> - it will locate your GitHub user by public-email part. Note that this email must be made public on Github.
  4. Anything <other-email> - it will locate your GitHub user by other-email part but only if that email was used before for any other CLA as a main commit author.
  5. login <any-valid-email> - it will locate your GitHub user by login part, note that login part must be at least 3 characters long.

Alternatively, if the co-author should not be included, remove the Co-authored-by: line from the commit message.

Please update your commit message(s) by doing git commit --amend and then git push [--force] and then request re-running CLA check via commenting on this pull request:

/easycla

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@ocelotl ocelotl marked this pull request as draft June 25, 2026 01:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

1 participant