Skip to content

feat(config): wire tracer/meter/logger configurator experimental fields - #5418

Open
ocelotl wants to merge 6 commits into
open-telemetry:mainfrom
ocelotl:issue_5390_wire_configurator_fields
Open

feat(config): wire tracer/meter/logger configurator experimental fields#5418
ocelotl wants to merge 6 commits into
open-telemetry:mainfrom
ocelotl:issue_5390_wire_configurator_fields

Conversation

@ocelotl

@ocelotl ocelotl commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Fixes #5390.

Description

The declarative configuration parser reads the experimental
tracer_configurator/development, meter_configurator/development and
logger_configurator/development fields into dataclass instances, but
create_tracer_provider, create_meter_provider and create_logger_provider
ignored them — the parsed values were silently discarded.

This wires each ExperimentalXConfigurator into the SDK's existing rule-based
configurator support:

  • Every per-scope entry (tracers / meters / loggers) becomes an
    instrumentation-scope name-glob rule (via the SDK's
    _scope_name_matches_glob) carrying that scope's enabled flag.
  • default_config supplies the fallback config for scopes matching no glob.
  • Rules are evaluated in order, so earlier entries take precedence.
  • The resulting configurator is passed to the provider constructor through its
    _x_configurator keyword, so per-instrumentation-scope enabled overrides
    now take effect (e.g. disabling a noisy tracer by name glob).

The logger minimum_severity and trace_based fields are accepted by the
config schema but have no equivalent in the Python SDK _LoggerConfig (which
only exposes is_enabled); when set they are ignored with a warning, matching
the existing pattern for unsupported log record limits.

Type of change

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

Added TestTracerConfigurator, TestMeterConfigurator and
TestLoggerConfigurator covering: glob-match disabling, default_config
fallback for unmatched scopes, first-matching-rule-wins ordering, absent
enabled defaulting to enabled, no-configurator passthrough, and (logger) the
unsupported-fields warning. Each asserts behavior through the SDK provider's
_apply_*_configurator.

  • ruff check opentelemetry-configuration/ — clean
  • pytest opentelemetry-configuration/tests/ — 379 passed (16 new)

Does This PR Require a Contrib Repo Change?

  • No.

Checklist:

  • Followed the style guidelines of this project
  • Changelog updated (.changelog/5390.added)
  • Unit tests have been added
  • Documentation has been updated

@github-actions

Copy link
Copy Markdown

This PR has been automatically marked as stale because it has not had any activity for 14 days. It will be closed if no further activity occurs within 14 days of this comment.
If you're still working on this, please add a comment or push new commits.

@github-actions github-actions Bot added the Stale label Jul 30, 2026
@ocelotl
ocelotl force-pushed the issue_5390_wire_configurator_fields branch 2 times, most recently from 3f08c98 to 7cd19f2 Compare July 30, 2026 21:35
@ocelotl
ocelotl marked this pull request as ready for review July 30, 2026 21:38
@ocelotl
ocelotl requested a review from a team as a code owner July 30, 2026 21:38
@github-actions github-actions Bot removed the Stale label Jul 31, 2026
@ocelotl
ocelotl force-pushed the issue_5390_wire_configurator_fields branch from 5495695 to 59659ba Compare August 4, 2026 21:43
@opentelemetry-pr-dashboard

opentelemetry-pr-dashboard Bot commented Aug 14, 2026

Copy link
Copy Markdown

Pull request dashboard status

Waiting on the author · refreshed 2026-08-25 12:31 UTC

Respond to 2 review items (e.g. link a commit, explain why not, ask a follow-up):

  • Inline threads: 1
  • Top-level threads: 2
Status above doesn't look right?
  • Just replied or pushed? Anything around or after the refresh time above may not be picked up yet — give it a few minutes.
  • Should this be with reviewers? Comment /dashboard route:reviewers to route it to them.
  • Anything wrong — including the routing? Report it with what you expected; it helps us improve the dashboard.

@xrmx xrmx left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please also add a test that verifies that we get what we expect from these configurator nodes in the yaml?

Comment thread opentelemetry-configuration/tests/test_logger_provider.py Outdated
@github-project-automation github-project-automation Bot moved this to Reviewed PRs that need fixes in Python PR digest Aug 20, 2026
@xrmx xrmx moved this from Reviewed PRs that need fixes to Ready for review in Python PR digest Aug 20, 2026
@ocelotl
ocelotl force-pushed the issue_5390_wire_configurator_fields branch from 59659ba to 82bc843 Compare August 20, 2026 11:46
ocelotl and others added 6 commits August 24, 2026 08:45
The declarative configuration parser reads the experimental
tracer_configurator/development, meter_configurator/development and
logger_configurator/development fields into dataclasses, but
create_tracer_provider, create_meter_provider and create_logger_provider
ignored them, so the parsed values were silently discarded.

Map each ExperimentalXConfigurator to a rule-based SDK configurator: every
per-scope entry becomes an instrumentation-scope name-glob rule carrying the
scope's enabled flag, and default_config supplies the fallback config. The
resulting configurator is passed to the provider constructor via the
_x_configurator keyword, so per-instrumentation-scope enabled overrides now
take effect.

The logger minimum_severity and trace_based fields are accepted by the schema
but unsupported by the Python SDK _LoggerConfig; they are ignored with a
warning.
Load a YAML fixture exercising the tracer/meter/logger
configurator/development nodes through load_config_file, then assert both
that the parsed model tree matches expectations and that each provider
created from it applies the per-scope enabled overrides.
Split the unsupported-field warning test so both minimum_severity and
trace_based are covered by their own assertions.
The configurator files were formatted at a shorter line length; ruff
format at the repo line-length collapses the wrapped lines. Reformat so
the precommit CI job passes.
@github-project-automation github-project-automation Bot moved this from Ready for review to Approved PRs in Python PR digest Aug 25, 2026
@xrmx
xrmx requested a lite review from Copilot August 25, 2026 10:26

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 updates the opentelemetry-configuration package so the experimental declarative-config fields for per-instrumentation-scope configurators (tracer_configurator/development, meter_configurator/development, logger_configurator/development) are no longer parsed-and-discarded, but instead are converted into the SDK’s existing rule-based configurator mechanism and passed into the corresponding SDK providers.

Changes:

  • Wire tracer/meter/logger experimental configurator config into create_tracer_provider, create_meter_provider, and create_logger_provider via SDK rule-based configurators and _scope_name_matches_glob.
  • Add unit tests for tracer/meter/logger configurator wiring behavior, plus an end-to-end YAML parse + wiring test.
  • Add a changelog entry documenting the new behavior and the logger unsupported-fields warning behavior.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
opentelemetry-configuration/src/opentelemetry/configuration/_tracer_provider.py Build and pass a _RuleBasedTracerConfigurator derived from experimental config into TracerProvider.
opentelemetry-configuration/src/opentelemetry/configuration/_meter_provider.py Build and pass a _RuleBasedMeterConfigurator derived from experimental config into MeterProvider.
opentelemetry-configuration/src/opentelemetry/configuration/_logger_provider.py Build and pass a _RuleBasedLoggerConfigurator derived from experimental config into LoggerProvider, and warn when unsupported logger fields are provided.
opentelemetry-configuration/tests/test_tracer_provider.py Add unit tests asserting tracer configurator rules are applied via _apply_tracer_configurator.
opentelemetry-configuration/tests/test_meter_provider.py Add unit tests asserting meter configurator rules are applied via _apply_meter_configurator.
opentelemetry-configuration/tests/test_logger_provider.py Add unit tests asserting logger configurator rules are applied and unsupported-fields warnings are emitted.
opentelemetry-configuration/tests/file/test_configurator_yaml.py Add YAML-driven integration test validating parsing + provider wiring for all three configurators.
opentelemetry-configuration/tests/file/data/configurator_config.yaml Add YAML fixture containing the configurator nodes used by the integration test.
.changelog/5418.added Document the new configurator wiring and unsupported logger fields behavior.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +240 to +245
if config.minimum_severity is not None or config.trace_based is not None:
_logger.warning(
"logger_configurator minimum_severity/trace_based are specified in "
"config but are not supported by the Python SDK LoggerProvider; "
"they will be ignored."
)

@xrmx xrmx Aug 25, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can ignore this if we don't want to complicate things. Or merge the change if you are willing to update tests

Comment thread .changelog/5418.added
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Approved PRs

Development

Successfully merging this pull request may close these issues.

feat(config): wire tracer/meter/logger configurator experimental fields

4 participants