Skip to content

feat: Add ConfigPropertiesBackedConfigProvider options for extensions and distros#15835

Closed
aviralgarg05 wants to merge 14 commits into
open-telemetry:mainfrom
aviralgarg05:fix/issue-15811
Closed

feat: Add ConfigPropertiesBackedConfigProvider options for extensions and distros#15835
aviralgarg05 wants to merge 14 commits into
open-telemetry:mainfrom
aviralgarg05:fix/issue-15811

Conversation

@aviralgarg05

@aviralgarg05 aviralgarg05 commented Jan 11, 2026

Copy link
Copy Markdown
Contributor

…BackedConfigProvider options

- Enhance ConfigPropertiesBackedConfigProvider with Builder for custom mappings

- Refactor ConfigPropertiesBackedDeclarativeConfigProperties to support mappings

- Deprecate DeclarativeConfigPropertiesBridge

- Addresses issue open-telemetry#15811
@aviralgarg05
aviralgarg05 requested a review from a team as a code owner January 11, 2026 20:41
- Fix ConfigPropertiesBackedConfigProvider compilation warnings

- Fix Spotless formatting violations in all bridge files

- Suppress deprecation warnings in backward compatibility tests
The spring-boot-autoconfigure and javaagent-tooling modules need to continue using
the deprecated DeclarativeConfigPropertiesBridge API to maintain backward compatibility
during the transition period. This commit adds @SuppressWarnings annotations with
explanatory comments and compiler flags to suppress deprecation warnings.
@github-actions github-actions Bot added the test native This label can be applied to PRs to trigger them to run native tests label Jan 12, 2026
@trask

trask commented Feb 14, 2026

Copy link
Copy Markdown
Member

cc @zeitlinger

@zeitlinger zeitlinger left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great 😄

@zeitlinger

Copy link
Copy Markdown
Member

pr title is misleading - nothing is replaced it this PR - just new functions added

@aviralgarg05 aviralgarg05 changed the title feat: Replace DeclarativeConfigPropertiesBridge with ConfigPropertiesBackedConfigProvider options feat: Add ConfigPropertiesBackedConfigProvider options for extensions and distros Feb 19, 2026
Comment thread instrumentation/spring/spring-boot-autoconfigure/build.gradle.kts Outdated
Comment thread javaagent-tooling/build.gradle.kts Outdated
Comment thread .gitignore Outdated
# Conflicts:
#	declarative-config-bridge/src/test/java/io/opentelemetry/instrumentation/config/bridge/ConfigPropertiesBackedDeclarativeConfigPropertiesTest.java
@github-actions github-actions Bot mentioned this pull request May 5, 2026
# Conflicts:
#	declarative-config-bridge/src/test/java/io/opentelemetry/instrumentation/config/bridge/ConfigPropertiesBackedDeclarativeConfigPropertiesTest.java

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR extends the declarative-config-bridge module so that extensions and distros can supply custom property mappings when bridging ConfigProperties into DeclarativeConfigProperties (declarative/YAML config). It adds a Builder to ConfigPropertiesBackedConfigProvider and threads a custom-mappings map through ConfigPropertiesBackedDeclarativeConfigProperties, merging user mappings on top of the built-in SPECIAL_MAPPINGS while rejecting attempts to override built-ins. This addresses issue #15811.

Changes:

  • Added ConfigPropertiesBackedConfigProvider.builder() with addMapping(...) and build(ConfigProperties) for supplying custom declarative→config-property mappings.
  • Added an overload createInstrumentationConfig(ConfigProperties, Map<String,String>) that merges custom mappings with built-ins and throws IllegalArgumentException on override of a built-in mapping; instance now carries the merged mappings map through getStructured navigation.
  • Added tests for builder mappings, default mappings, and rejection of built-in overrides.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
ConfigPropertiesBackedConfigProvider.java Introduces Builder and routes create/build through the new mapping-aware factory.
ConfigPropertiesBackedDeclarativeConfigProperties.java Adds mappings field, a mapping-aware factory with built-in override validation, and propagates mappings through navigation.
ConfigPropertiesBackedConfigProviderTest.java New tests covering builder mappings, defaults, and override rejection.
ConfigPropertiesBackedDeclarativeConfigPropertiesTest.java Adds a test verifying custom mappings coexist with special mappings.

@opentelemetry-pr-dashboard

Copy link
Copy Markdown

This PR has review comments. Review suggestions, whether from maintainers or automated reviewers, aren't always correct or required. Please evaluate each comment on its merits, then make sure each thread has a clear outcome.

For example, link to the commit if you applied a suggestion, explain why it wasn't applied, or ask a follow-up question.

Automation flags a PR for human review once every review thread has a reply or is marked as resolved.

Status across open PRs is visible on the pull request dashboard.

@trask

trask commented Jul 9, 2026

Copy link
Copy Markdown
Member

@robsunday @zeitlinger do you still need this feature? thanks!

@zeitlinger

zeitlinger commented Jul 13, 2026

Copy link
Copy Markdown
Member

This would unblock follow-up work in opentelemetry-java-contrib that replaces the remaining usages of DeclarativeConfigPropertiesBridgeBuilder with the non-deprecated bridge API.

In particular, the custom mapping support here is what we need for the contrib declarative component providers. Once this lands, it should let us finish migrating those callers and keep the old bridge on track for removal in 3.0.

#19202
open-telemetry/opentelemetry-java-contrib#2988

@zeitlinger

Copy link
Copy Markdown
Member

Closing this in favor of #19220, which carries the current version of the bridge work, including the configurable access path, the shared duration helper, and the added docs/tests based on the contrib follow-up.

@zeitlinger zeitlinger closed this Jul 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test native This label can be applied to PRs to trigger them to run native tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants