feat(config): Add LoggerProvider support for declarative config#4990
Draft
MikeGoldsmith wants to merge 11 commits intoopen-telemetry:mainfrom
Draft
feat(config): Add LoggerProvider support for declarative config#4990MikeGoldsmith wants to merge 11 commits intoopen-telemetry:mainfrom
MikeGoldsmith wants to merge 11 commits intoopen-telemetry:mainfrom
Conversation
Implements create_resource() and create_propagator()/configure_propagator() for the declarative file configuration. Resource creation does not read OTEL_RESOURCE_ATTRIBUTES or run any detectors (matches Java/JS SDK behavior). Propagator configuration always calls set_global_textmap to override Python's default tracecontext+baggage, setting a noop CompositePropagator when no propagator is configured. Assisted-by: Claude Sonnet 4.6
Assisted-by: Claude Sonnet 4.6
- _resource.py: refactor _coerce_attribute_value to dispatch table to avoid too-many-return-statements; fix short variable names k/v -> attr_key/attr_val; fix return type of _sdk_default_attributes to dict[str, str] to satisfy pyright - _propagator.py: rename short variable names e -> exc, p -> propagator - test_resource.py: move imports to top level; split TestCreateResource (25 methods) into three focused classes to satisfy too-many-public-methods - test_propagator.py: add pylint disable for protected-access Assisted-by: Claude Sonnet 4.6
- replace _sdk_default_attributes() with _DEFAULT_RESOURCE from resources module - move _coerce_bool into dispatch tables for both scalar and array bool types, fixing a bug where bool_array with string values like "false" would coerce incorrectly via plain bool() (non-empty string -> True) - add test for bool_array with string values to cover the bug Assisted-by: Claude Sonnet 4.6
… into mike/config-resource-propagator
…erge - collapse _SCALAR_COERCIONS and _ARRAY_COERCIONS into a single _COERCIONS dict using an _array() factory, reducing _coerce_attribute_value to two lines - process attributes_list before attributes so explicit attributes naturally overwrite list entries without needing an explicit guard Assisted-by: Claude Sonnet 4.6
…config Implements LoggerProvider instantiation from declarative config files, following the same env-var-suppression pattern as create_meter_provider. BatchLogRecordProcessor defaults use spec values (1000ms schedule_delay), overriding the Python SDK's incorrect 5000ms env-var default. Assisted-by: Claude Sonnet 4.6
…metry#4990) Assisted-by: Claude Sonnet 4.6
themavik
reviewed
Mar 19, 2026
themavik
left a comment
There was a problem hiding this comment.
Nice addition. In _logger_provider.py, _parse_headers: when headers_list has a pair like "key=", the split gives value="" — that's fine. But if someone passes "key" (no equals), you warn and skip. Consider whether an empty value should be allowed for "key=" or if that should also warn. Minor — the current behavior is reasonable.
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
Implements `create_logger_provider()` and `configure_logger_provider()` for the declarative configuration pipeline, as part of the ongoing work tracked in the following issue:
Note
This PR is based on #4979 (Resource & Propagator creation) which must be merged first. The extra commits at the base of this branch will be dropped once that PR lands.
What's included
Env-var suppression
Python's `BatchLogRecordProcessor` reads `OTEL_BLRP_*` env vars when params are `None`. To match the spec's "what you see is what you get" semantics, we always pass explicit values — defaulting to spec defaults. Notably, the Python SDK's default for `OTEL_BLRP_SCHEDULE_DELAY` is 5000ms (incorrect per spec); we pass 1000ms per the OTel spec.
Type of change
How Has This Been Tested?
Does This PR Require a Contrib Repo Change?
No.
Checklist