config: load and validate generated config models#4898
Draft
MikeGoldsmith wants to merge 21 commits intoopen-telemetry:mainfrom
Draft
config: load and validate generated config models#4898MikeGoldsmith wants to merge 21 commits intoopen-telemetry:mainfrom
MikeGoldsmith wants to merge 21 commits intoopen-telemetry:mainfrom
Conversation
Proposing that the first step towards implementing OpenTelemetry Configuration is to produce the model code from the json schema. I did a quick search for tools available to do this and came across datamodel-codegen which seems to do what i expected. Will open following pull requests (in draft) to use this model code, i just want to keep these as clearly separated as possible to make reviewing them easier. Signed-off-by: alex boten <223565+codeboten@users.noreply.github.com>
… into codeboten/generate-config-model-from-schema
…ate-config-model-from-schema fix code-generation command and regenerate models
…ate-config-model-from-schema.2 Fix lint errors and update uv.lock file
Signed-off-by: alex boten <223565+codeboten@users.noreply.github.com>
… into codeboten/generate-config-model-from-schema
…com:codeboten/opentelemetry-python into mike/otel-config/1-loading-validation
datamodel-codegen section was inserted between [tool.pyright] and its include/exclude config, causing pyright to check entire repo (599 files) instead of just included paths. Moved datamodel-codegen section after pyright config.
…com:codeboten/opentelemetry-python into mike/otel-config/1-loading-validation
- Fix re.sub callback return type (must return str, not str | None) - Rename DOLLAR_PLACEHOLDER to dollar_placeholder (pylint naming) - Rename f to temp_file/config_file (pylint naming) - Update uv.lock
Fixes yaml import warning by installing PyYAML type stubs and the file-configuration optional dependencies.
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
The next step of implementing configuration file support. This PR loads the generated files validates them. Using the model to configure the SDK will come in later PRs.
Based on the following PR which added model generation from the schema:
Contributes to:
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
32 unit tests covering file loading, parsing (YAML/JSON), env substitution, and error handling.
Does This PR Require a Contrib Repo Change?
Checklist: