Skip to content

Extract declarative config to new opentelemetry-sdk-extension-decelar…#8265

Open
jack-berg wants to merge 1 commit intoopen-telemetry:mainfrom
jack-berg:new-declarative-config-module
Open

Extract declarative config to new opentelemetry-sdk-extension-decelar…#8265
jack-berg wants to merge 1 commit intoopen-telemetry:mainfrom
jack-berg:new-declarative-config-module

Conversation

@jack-berg
Copy link
Copy Markdown
Member

@jack-berg jack-berg commented Apr 8, 2026

Resolves #7292

Extract declarative config from opentelemetry-sdk-extension-incubator to opentelemetry-sdk-extension-declarative-config.

Root package at io.opentelemetry.sdk.declarative.config.

Other options considered:

  • opentelemetry-sdk-config - I.e. make declarative config a peer of opentelemetry-sdk-{signal}. The existence of SdkConfigProvider - which currently resides in opentelemetry-sdk-all suggests this should be the case. However, declarative config requires dependencies on each of the other opentelemetry-sdk-{signal} modules, and has a YAML dependency which we'll want to keep opt in.
  • opentelemetry-sdk-extension-autoconfigure - I.e. extend existing autoconfigure with declarative config. I don't hate this idea, but it would mean adding a YAML dependency to autoconfigure. As it stands currently and with this PR, autoconfigure has a compileOnly dependency on declarative config where the behavior changes at runtime if available, i.e. we start looking for OTEL_CONFIG_FILE being set and if so delegating config to declarative config.

Coming in a followup PRs:

  • Commit schema generated POJOs to version control. Now that declarative config is stable, we should work towards adding the POJOs corresponding to stable types to our stable API. This will allow users to reliably build / customize the in-memory representation of the data model.
  • Consider making YAML parsing pluggable. Right now we use org.snakeyaml:snakeyaml-engine for parse input YAML string to Object, then we use jackson to convert Object to OpenTelemetryConfigurationModel. If org.snakeyaml.snakeyaml-engine had unsolved vulnerabilities or if breaking changes caused runtime errors from the diamond dependency problem, then users would have no recourse. We could make these functions pluggable via SPI and try to provide at least one other implementation.

@jack-berg jack-berg requested a review from a team as a code owner April 8, 2026 14:12
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 8, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.29%. Comparing base (ec002c3) to head (b60c2eb).

Additional details and impacted files
@@            Coverage Diff            @@
##               main    #8265   +/-   ##
=========================================
  Coverage     90.29%   90.29%           
  Complexity     7656     7656           
=========================================
  Files           844      844           
  Lines         23071    23071           
  Branches       2311     2311           
=========================================
  Hits          20832    20832           
  Misses         1521     1521           
  Partials        718      718           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jack-berg jack-berg force-pushed the new-declarative-config-module branch from eb396e1 to b60c2eb Compare April 8, 2026 16:43
Copy link
Copy Markdown
Contributor

@robsunday robsunday left a comment

Choose a reason for hiding this comment

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

Looks good with some minor comments

private static final boolean DECLARATIVE_CONFIG_AVAILABLE;

static {
boolean incubatorAvailable = false;
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.

It would be good to rename it to declarativeConfigAvailable

compileOnly(project(":api:incubator"))
compileOnly(project(":sdk-extensions:incubator"))
compileOnly(project(":sdk-extensions:declarative-config"))
// compileOnly(project(":sdk-extensions:incubator"))
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.

Commented line could be removed

* Utilities for interacting with ({@code
* io.opentelemetry:opentelemetry-sdk-extension-declarative-config}, which is not guaranteed to be
* present on the classpath. For all methods, callers MUST first separately reflectively confirm
* that the incubator is available on the classpath.
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.

Comment needs to be updated because it mentions incubator

Copy link
Copy Markdown
Member

@zeitlinger zeitlinger left a comment

Choose a reason for hiding this comment

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

Root package is io.opentelemetry.sdk.declarativeconfig - not io.opentelemetry.sdk.declarative.config as pr body says.

I do want to try out the opentelemetry-sdk-extension-autoconfigure alternative in a different PR. Will link here when done.

|-------------------------------------------------------------------------------|------------------------------------------------------------------------------------|-----------------------------------------------------|-------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [SDK Autoconfigure](./sdk-extensions/autoconfigure) | Autoconfigure OpenTelemetry SDK from env vars, system properties, and SPI | `opentelemetry-sdk-extension-autoconfigure` | <!--VERSION_STABLE-->1.60.1<!--/VERSION_STABLE--> | [![Javadocs](https://www.javadoc.io/badge/io.opentelemetry/opentelemetry-sdk-extension-autoconfigure.svg)](https://www.javadoc.io/doc/io.opentelemetry/opentelemetry-sdk-extension-autoconfigure) |
| [SDK Autoconfigure SPI](./sdk-extensions/autoconfigure-spi) | Service Provider Interface (SPI) definitions for autoconfigure | `opentelemetry-sdk-extension-autoconfigure-spi` | <!--VERSION_STABLE-->1.60.1<!--/VERSION_STABLE--> | [![Javadocs](https://www.javadoc.io/badge/io.opentelemetry/opentelemetry-sdk-extension-autoconfigure-spi.svg)](https://www.javadoc.io/doc/io.opentelemetry/opentelemetry-sdk-extension-autoconfigure-spi) |
| [SDK Declarative Config](./sdk-extensions/jaeger-remote-sampler) | Declarative config implementation for YAML-based SDK configuration | `opentelemetry-sdk-extension-declarative-config` | TODO: add after first release | TODO: add after first release |
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.

Suggested change
| [SDK Declarative Config](./sdk-extensions/jaeger-remote-sampler) | Declarative config implementation for YAML-based SDK configuration | `opentelemetry-sdk-extension-declarative-config` | TODO: add after first release | TODO: add after first release |
| [SDK Declarative Config](./sdk-extensions/declarative-config) | Declarative config implementation for YAML-based SDK configuration | `opentelemetry-sdk-extension-declarative-config` | TODO: add after first release | TODO: add after first release |

@zeitlinger
Copy link
Copy Markdown
Member

I do want to try out the opentelemetry-sdk-extension-autoconfigure alternative in a different PR. Will link here when done.

Here it is: #8270

That new PR has the advantage that it keeps the yaml deps optional.

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.

Move declarative config to permanent home

3 participants