Skip to content

Replace declarative config bridge usages in contrib#2988

Merged
jaydeluca merged 11 commits into
open-telemetry:mainfrom
zeitlinger:agent/replace-declarative-config-properties-bridge-usages
Jul 24, 2026
Merged

Replace declarative config bridge usages in contrib#2988
jaydeluca merged 11 commits into
open-telemetry:mainfrom
zeitlinger:agent/replace-declarative-config-properties-bridge-usages

Conversation

@zeitlinger

@zeitlinger zeitlinger commented Jul 13, 2026

Copy link
Copy Markdown
Member

Summary

  • replace the remaining contrib DeclarativeConfigPropertiesBridgeBuilder usages in span-stacktrace and inferred-spans
  • switch those modules to the new ConfigPropertiesBackedConfigProvider access-path API
  • keep the declarative config access in inferred-spans on flat underscore keys
  • remove duplicated duration parsing by using DeclarativeConfigPropertiesDurationUtil.parseDuration(...)

Why

DeclarativeConfigPropertiesBridge is being deprecated in opentelemetry-java-instrumentation, and these remaining contrib usages need to move off it first.

This change depends on open-telemetry/opentelemetry-java-instrumentation#19220, which supersedes #15835 and adds the bridge helpers used here.

Related deprecation PR: open-telemetry/opentelemetry-java-instrumentation#19202

The unrelated SamplingProfilerTest flake fix was split into #3000.

How this uses the new bridge APIs

  • inferred-spans bridges the component root directly to otel.inferred.spans. with ConfigPropertiesBackedConfigProvider.builder().setAccessPath("", "otel.inferred.spans.")
  • span-stacktrace bridges the component root directly to otel.java.experimental.span-stacktrace. the same way
  • both modules use DeclarativeConfigPropertiesDurationUtil.parseDuration(...) instead of carrying their own parsing copy

Breaking behavior change

Declarative config YAML now only accepts integer millisecond values for these duration properties.

Examples:

  • supported: min_duration: 100
  • not supported in declarative YAML anymore: min_duration: 100ms

That matches the behavior documented on DeclarativeConfigPropertiesDurationUtil: flat ConfigProperties inputs can still use string durations such as 42ms, but non-ConfigProperties declarative config only accepts integer milliseconds.

Testing

  • GRADLE_USER_HOME=/tmp/gradle-home-otel-java-contrib ./gradlew --no-build-cache --no-configuration-cache -PuseLocalMaven :span-stacktrace:check :inferred-spans:check

CI note

The newly added InferredSpansConfigTest creates a real InferredSpansProcessor, which loads async-profiler. Async-profiler is not supported on Windows, so the test is disabled there with the same @DisabledOnOs(WINDOWS) guard used by the other inferred-spans tests that instantiate it. Earlier CI failures across all platforms masked this Windows-only failure until the dependency and deprecation-warning issues were fixed.

Additional verification:

  • GRADLE_USER_HOME=/tmp/gradle-home-otel-java-contrib-pr2988 ./gradlew --no-build-cache --no-configuration-cache :inferred-spans:check

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>
@zeitlinger
zeitlinger force-pushed the agent/replace-declarative-config-properties-bridge-usages branch from 3b81d9c to e3fefc2 Compare July 13, 2026 15:46
Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
zeitlinger and others added 2 commits July 14, 2026 08:39
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>
Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
@zeitlinger
zeitlinger marked this pull request as ready for review July 23, 2026 12:57
@zeitlinger
zeitlinger requested a review from a team as a code owner July 23, 2026 12:57
Copilot AI review requested due to automatic review settings July 23, 2026 12:57

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

Migrates remaining contrib usages off DeclarativeConfigPropertiesBridgeBuilder in span-stacktrace and inferred-spans, updating both modules to consume component-scoped DeclarativeConfigProperties (underscore keys) and using the newer bridge helpers for accessing ConfigProperties via a component access path.

Changes:

  • Switch span-stacktrace and inferred-spans component providers/autoconfig to use component-scoped DeclarativeConfigProperties rather than building a ConfigProperties bridge mapping.
  • Replace duration parsing with DeclarativeConfigDurationUtil.getDuration(...) to align declarative YAML duration behavior (integer millis) with the shared bridge utilities.
  • Add/adjust tests to validate declarative mapping coverage and update dependency management to the newer instrumentation alpha.

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
span-stacktrace/src/test/java/io/opentelemetry/contrib/stacktrace/StackTraceAutoConfigTest.java Updates tests to validate behavior through the new component-scoped declarative config path.
span-stacktrace/src/main/java/io/opentelemetry/contrib/stacktrace/StackTraceComponentProvider.java Removes bridge builder mapping and delegates directly to StackTraceAutoConfig with declarative properties.
span-stacktrace/src/main/java/io/opentelemetry/contrib/stacktrace/StackTraceAutoConfig.java Introduces component-scoped declarative properties for autoconfig and uses bridge duration util for min_duration.
inferred-spans/src/test/java/io/opentelemetry/contrib/inferredspans/internal/SamplingProfilerTest.java Adjusts timing sleeps (note: appears unrelated to stated PR scope).
inferred-spans/src/test/java/io/opentelemetry/contrib/inferredspans/InferredSpansSpanProcessorProviderTest.java Adds a comprehensive declarative YAML-to-config mapping coverage test (disabled on Windows).
inferred-spans/src/test/java/io/opentelemetry/contrib/inferredspans/InferredSpansConfigTest.java New test validating ConfigProperties → component declarative properties mapping (disabled on Windows).
inferred-spans/src/test/java/io/opentelemetry/contrib/inferredspans/InferredSpansAutoConfigTest.java Updates autoconfig test inputs to use full otel.inferred.spans.* keys now that internals use component-scoped keys.
inferred-spans/src/main/java/io/opentelemetry/contrib/inferredspans/InferredSpansSpanProcessorProvider.java Removes bridge builder mapping and uses InferredSpansConfig directly with declarative properties.
inferred-spans/src/main/java/io/opentelemetry/contrib/inferredspans/InferredSpansConfig.java Refactors config application to read underscore keys from DeclarativeConfigProperties and uses duration util.
inferred-spans/src/main/java/io/opentelemetry/contrib/inferredspans/InferredSpansAutoConfig.java Uses component-scoped declarative properties in autoconfig gating and processor creation.
inferred-spans/build.gradle.kts Ensures the declarative-config bridge dependency is present for tests.
dynamic-control/src/main/java/io/opentelemetry/contrib/dynamic/TelemetryPolicySamplerComponentProvider.java Adds a targeted deprecation suppression for an upcoming migration.
dependencyManagement/build.gradle.kts Bumps opentelemetry-java-instrumentation alpha version to pick up the new bridge helpers.

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

@breedx-splk breedx-splk 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.

Thanks for picking this up, @zeitlinger.

@jaydeluca
jaydeluca added this pull request to the merge queue Jul 24, 2026
Merged via the queue into open-telemetry:main with commit fcd3538 Jul 24, 2026
25 checks passed
@zeitlinger
zeitlinger deleted the agent/replace-declarative-config-properties-bridge-usages branch July 24, 2026 16:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants