fix(config): align additional_properties typing#5286
Open
hariharan077 wants to merge 1 commit into
Open
Conversation
Declare generated additional_properties fields as instance dataclass fields, matching the @_additional_properties decorator runtime behavior and _ComponentConfig protocol. Skip non-init dataclass fields when resolving configured resource detectors so the new generated field is not treated as a detector. Assisted-by: ChatGPT
6b20701 to
8eb46b0
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
Fixes #5268.
Declare generated config model
additional_propertiesattributes as instance dataclass fields instead ofClassVars, matching the runtime behavior of@_additional_propertiesand the_ComponentConfigprotocol.This also skips non-init dataclass fields while resolving configured resource detectors, so the generated
additional_propertiesfield is not treated as a detector name.Type of change
How Has This Been Tested?
SpanExporter/_resolve_componentrepro before the fix0 errors, 0 warnings, 0 informations.tox/py310-test-opentelemetry-sdk/bin/python -m pytest opentelemetry-sdk/tests/_configuration/test_common.py opentelemetry-sdk/tests/_configuration/test_resource.py -quv run tox -r -e typecheckuv run tox -r -e lint-opentelemetry-sdkuv run ruff check opentelemetry-sdk/src/opentelemetry/sdk/_configuration/models.py opentelemetry-sdk/src/opentelemetry/sdk/_configuration/_common.py opentelemetry-sdk/src/opentelemetry/sdk/_configuration/_resource.py opentelemetry-sdk/tests/_configuration/test_common.pyuv run ruff format --check opentelemetry-sdk/src/opentelemetry/sdk/_configuration/models.py opentelemetry-sdk/src/opentelemetry/sdk/_configuration/_common.py opentelemetry-sdk/src/opentelemetry/sdk/_configuration/_resource.py opentelemetry-sdk/tests/_configuration/test_common.pygit diff --checkDoes This PR Require a Contrib Repo Change?
Checklist:
No changelog or documentation update is included because this is an internal typing/codegen consistency fix for declarative configuration models.