-
Notifications
You must be signed in to change notification settings - Fork 991
Add option to programmatically customization declarative config components, add supplementary guidance #4777
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
jack-berg
merged 8 commits into
open-telemetry:main
from
jack-berg:declarative-config-programmmatic-customization
Dec 15, 2025
Merged
Changes from 1 commit
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
d465b4e
Add option to programmatically customization declarative config compo…
jack-berg 2793a98
typos
jack-berg a164172
Merge branch 'main' of https://github.com/open-telemetry/opentelemetr…
jack-berg b1710d5
generalize callback
jack-berg 51581ce
Merge branch 'main' into declarative-config-programmmatic-customization
maryliag 712582f
Merge branch 'main' of https://github.com/open-telemetry/opentelemetr…
jack-berg 25bc723
Merge branch 'declarative-config-programmmatic-customization' of http…
jack-berg 82273bb
Add changelog entry
jack-berg File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| # Supplementary Guidelines | ||
|
|
||
| Note: this document is NOT a spec, it is provided to support the declarative config | ||
| [API](./api.md) and [SDK](./sdk.md) specifications, it does NOT add any extra | ||
| requirements to the existing specifications. | ||
|
|
||
| <details> | ||
| <summary>Table of Contents</summary> | ||
|
|
||
| <!-- toc --> | ||
|
|
||
| - [Configuration interface prioritization and `create`](#configuration-interface-prioritization-and-create) | ||
| - [Programmatic customization and `create`](#programmatic-customization-and-create) | ||
|
|
||
| <!-- tocstop --> | ||
|
|
||
| </details> | ||
|
|
||
| ## Configuration interface prioritization and `create` | ||
|
|
||
| With the [environment variable](./sdk-environment-variables.md) configuration | ||
| interface, the spec failed to answer the question of whether programmatic or | ||
| environment variable configuration took precedence. This led to differences in | ||
| implementations that were ultimately stabilized and difficult to resolve after | ||
| the fact. | ||
|
|
||
| With declarative config, we don't have ambiguity around configuration interface | ||
| precedence: | ||
|
|
||
| * [`parse`](./sdk.md#parse) is responsible for parsing config file contents and | ||
| returning the corresponding in-memory data model. Along the way, it | ||
| performs [environment variable substitution](./data-model.md#environment-variable-substitution). | ||
| * [`create`](./sdk.md#create) is responsible for interpreting an in-memory | ||
| config data model and creating SDK components. | ||
|
|
||
| There is no precedence ambiguity with the environemnt variable configuration | ||
|
jack-berg marked this conversation as resolved.
Outdated
|
||
| interface: The language of `parse` and `create` is explicit about | ||
| responsibilities and makes no mention of merging environment variables outside | ||
| of environment variable substitution. | ||
| Furthermore, [OTEL_EXPERIMENTAL_CONFIG_FILE](./sdk-environment-variables.md#declarative-configuration) | ||
| explicitly states that the environment variable configuration scheme is ignored. | ||
|
|
||
| There is no precedence ambiguity with | ||
| the [programmatic configuration interface](./README.md#programmatic): `create` | ||
| consumes an in-memory config data model and creates SDK components. According to | ||
| the trace, metric, and log specs, SDKs MAY support updating the config, but | ||
| there is no conflict with declarative config which doesn't already exist. | ||
| However the SDK handles programmatic config updates to SDK components which | ||
| originally programmatically configured applies here as well. If an SDK supports | ||
| it, all programmatic config updates are applied after `create` initializes SDK | ||
| components and therefore take precedence. The semantics of what programmatic | ||
| config updates are allowed and how they merge with existing SDK components are | ||
| out of scope for declarative config. | ||
|
|
||
| ## Programmatic customization and `create` | ||
|
|
||
| While `create` does provide an optional mechanism for programmatic | ||
| customization, its use should be considered a code smell, to be addressed by | ||
| improving the declarative config data model. | ||
|
|
||
| For example, the fact that configuration of dynamic authentication for OTLP | ||
| exporters is not possible to express with declarative config should not | ||
| encourage the OpenTelemetry community to have better programmatic customization. | ||
| Instead, we should pursue adding authentication as an SDK extension plugin | ||
| interface and modeling this new plugin in declarative config. | ||
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.