feat(config): wire tracer/meter/logger configurator experimental fields - #5418
feat(config): wire tracer/meter/logger configurator experimental fields#5418ocelotl wants to merge 6 commits into
Conversation
|
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. |
3f08c98 to
7cd19f2
Compare
5495695 to
59659ba
Compare
Pull request dashboard statusWaiting 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): Status above doesn't look right?
|
xrmx
left a comment
There was a problem hiding this comment.
Could you please also add a test that verifies that we get what we expect from these configurator nodes in the yaml?
59659ba to
82bc843
Compare
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.
3eca3d8 to
c814858
Compare
There was a problem hiding this comment.
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, andcreate_logger_providervia 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.
| 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." | ||
| ) |
There was a problem hiding this comment.
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
Fixes #5390.
Description
The declarative configuration parser reads the experimental
tracer_configurator/development,meter_configurator/developmentandlogger_configurator/developmentfields into dataclass instances, butcreate_tracer_provider,create_meter_providerandcreate_logger_providerignored them — the parsed values were silently discarded.
This wires each
ExperimentalXConfiguratorinto the SDK's existing rule-basedconfigurator support:
tracers/meters/loggers) becomes aninstrumentation-scope name-glob rule (via the SDK's
_scope_name_matches_glob) carrying that scope'senabledflag.default_configsupplies the fallback config for scopes matching no glob._x_configuratorkeyword, so per-instrumentation-scopeenabledoverridesnow take effect (e.g. disabling a noisy tracer by name glob).
The logger
minimum_severityandtrace_basedfields are accepted by theconfig schema but have no equivalent in the Python SDK
_LoggerConfig(whichonly exposes
is_enabled); when set they are ignored with a warning, matchingthe existing pattern for unsupported log record
limits.Type of change
How Has This Been Tested?
Added
TestTracerConfigurator,TestMeterConfiguratorandTestLoggerConfiguratorcovering: glob-match disabling,default_configfallback for unmatched scopes, first-matching-rule-wins ordering, absent
enableddefaulting to enabled, no-configurator passthrough, and (logger) theunsupported-fields warning. Each asserts behavior through the SDK provider's
_apply_*_configurator.ruff check opentelemetry-configuration/— cleanpytest opentelemetry-configuration/tests/— 379 passed (16 new)Does This PR Require a Contrib Repo Change?
Checklist:
.changelog/5390.added)