Skip to content

Add InstrumentationDefaults helper to declarative-config-bridge#17816

Open
zeitlinger wants to merge 7 commits intoopen-telemetry:mainfrom
zeitlinger:instrumentation-defaults
Open

Add InstrumentationDefaults helper to declarative-config-bridge#17816
zeitlinger wants to merge 7 commits intoopen-telemetry:mainfrom
zeitlinger:instrumentation-defaults

Conversation

@zeitlinger
Copy link
Copy Markdown
Member

Summary

  • Adds InstrumentationDefaults to the declarative-config-bridge module — a utility for distributions to define instrumentation property defaults once and have them work in both configuration modes
  • setDefault(instrumentation, key, value) (fluent, returns this) stores defaults using underscore notation
  • toConfigProperties() translates to flat otel.instrumentation.* property map (underscore→hyphen) for traditional auto-configuration
  • applyToModel(OpenTelemetryConfigurationModel) injects defaults into the DC model under instrumentation/development.java, using putIfAbsent so explicit user config always wins

Extracted from grafana/grafana-opentelemetry-java#1226, which noted a TODO to propose this as a shared utility.

Test plan

  • InstrumentationDefaultsTest covers toConfigProperties(), applyToModel(), and the non-override semantics
  • ./gradlew :declarative-config-bridge:test passes

Provides a utility for distributions to define instrumentation property
defaults once and have them work with both traditional property-based
configuration (otel.instrumentation.*) and declarative configuration
(YAML model under instrumentation/development.java).

Extracted from grafana/grafana-opentelemetry-java#1226.
Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
@zeitlinger zeitlinger force-pushed the instrumentation-defaults branch from f25ec01 to 4559fdf Compare April 10, 2026 18:04
Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
…README

Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
@zeitlinger zeitlinger marked this pull request as ready for review April 13, 2026 17:32
@zeitlinger zeitlinger requested a review from a team as a code owner April 13, 2026 17:32
@zeitlinger
Copy link
Copy Markdown
Member Author

@jack-berg fyi - since we talked about it

@laurit
Copy link
Copy Markdown
Contributor

laurit commented Apr 14, 2026

@robsunday could you help reviewing this

Comment thread declarative-config-bridge/README.md Outdated
@zeitlinger zeitlinger marked this pull request as draft April 16, 2026 14:52
…readme to match DC API pattern

Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
Replace vararg setDefault(instr, key, value) with nested
defaults.get(name).setDefault(key, value). Mirrors
DeclarativeConfigProperties.getStructured(name).getString(key)
on the read side. README notes the symmetry.

Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
…symmetry note

DeclarativeConfigProperties.get(name) (added in open-telemetry/opentelemetry-java#7923)
is the standard read-side API; update InstrumentationDefaults javadoc and README to
match.

Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
@zeitlinger zeitlinger marked this pull request as ready for review April 18, 2026 08:50
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.

2 participants