Skip to content

Add contrib-facing helpers to the declarative config bridge#19220

Merged
trask merged 31 commits into
open-telemetry:mainfrom
zeitlinger:cp-bridge-for-contrib
Jul 20, 2026
Merged

Add contrib-facing helpers to the declarative config bridge#19220
trask merged 31 commits into
open-telemetry:mainfrom
zeitlinger:cp-bridge-for-contrib

Conversation

@zeitlinger

@zeitlinger zeitlinger commented Jul 14, 2026

Copy link
Copy Markdown
Member

Fixes #15811

Expose flat ConfigProperties through the declarative configuration APIs so instrumentation and external components can use the same root-relative configuration shape regardless of the source.

  • Add DeclarativeConfigBridge.createInstrumentationConfig(...) for the complete instrumentation configuration.
  • Add DeclarativeConfigBridge.createComponentProperties(...) for a component-local flat-property prefix.
  • Add DeclarativeConfigDurationUtil.getDuration(...) to share duration reads; flat ConfigProperties inputs support duration strings such as 42ms, while other declarative implementations provide integer milliseconds.
  • Deprecate ConfigPropertiesBackedConfigProvider in favor of DeclarativeConfigBridge, and deprecate DeclarativeConfigPropertiesBridgeBuilder in favor of reading DeclarativeConfigProperties directly.

Component-local reads retain the bridge's existing snake-case-to-kebab-case translation. The standard SDK flat configuration normalizes hyphens to periods, preserving existing dotted contrib properties such as otel.inferred.spans.backup.diagnostic.files and otel.inferred.spans.min.duration without introducing a component-specific naming rule.

The draft contrib migration in open-telemetry/opentelemetry-java-contrib#2988 will be updated separately to consume these final APIs. This supersedes #15835.

aviralgarg05 and others added 18 commits January 12, 2026 02:02
…BackedConfigProvider options

- Enhance ConfigPropertiesBackedConfigProvider with Builder for custom mappings

- Refactor ConfigPropertiesBackedDeclarativeConfigProperties to support mappings

- Deprecate DeclarativeConfigPropertiesBridge

- Addresses issue open-telemetry#15811
- 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.
# Conflicts:
#	declarative-config-bridge/src/test/java/io/opentelemetry/instrumentation/config/bridge/ConfigPropertiesBackedDeclarativeConfigPropertiesTest.java
# Conflicts:
#	declarative-config-bridge/src/test/java/io/opentelemetry/instrumentation/config/bridge/ConfigPropertiesBackedDeclarativeConfigPropertiesTest.java
Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>

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

Adds contrib-facing configuration bridge APIs for custom flat-property prefixes and shared duration parsing.

Changes:

  • Adds configurable access paths and custom mappings.
  • Adds duration parsing across flat and declarative configurations.
  • Documents and tests the new APIs.

Reviewed changes

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

Show a summary per file
File Description
declarative-config-bridge/README.md Documents bridge usage and duration parsing.
ConfigPropertiesBackedConfigProvider.java Adds the configurable builder API.
ConfigPropertiesBackedDeclarativeConfigProperties.java Supports mappings and custom prefixes.
DeclarativeConfigPropertiesDurationUtil.java Adds shared duration parsing.
ConfigPropertiesBackedConfigProviderTest.java Tests builder behavior.
ConfigPropertiesBackedDeclarativeConfigPropertiesTest.java Tests custom and built-in mappings.
DeclarativeConfigPropertiesDurationUtilTest.java Tests duration behavior by configuration source.

Comment thread declarative-config-bridge/README.md
@opentelemetry-pr-dashboard

opentelemetry-pr-dashboard Bot commented Jul 14, 2026

Copy link
Copy Markdown

Pull request dashboard status

Status last refreshed: 2026-07-20 23:34:11 UTC.

  • Status: Merged.

This automated status or its linked feedback items may be incorrect. If something looks wrong, report it with the result you expected.


private final ConfigProperties configProperties;
private final List<String> path;
private final Map<String, String> mappings;

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

not sure if it makes sense to extract an object that contains all of those properties (all but path)

Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
@zeitlinger zeitlinger added this to the v2.30.0 milestone Jul 14, 2026

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

Copilot reviewed 14 out of 14 changed files in this pull request and generated 3 comments.

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

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

Comment thread declarative-config-bridge/README.md Outdated

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

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

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

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

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

Copilot reviewed 15 out of 15 changed files in this pull request and generated no new comments.

# Conflicts:
#	CHANGELOG.md
#	instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/OpenTelemetryAutoConfiguration.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

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

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

Copilot reviewed 16 out of 16 changed files in this pull request and generated no new comments.

@trask
trask merged commit 61bc202 into open-telemetry:main Jul 20, 2026
189 of 192 checks passed
@zeitlinger
zeitlinger deleted the cp-bridge-for-contrib branch July 21, 2026 10:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

create a replacement for DeclarativeConfigPropertiesBridge for extensions and distros

4 participants