Skip to content

Make declarative config parsing and mapping pluggable - #8983

Open
ash-thakur-rh wants to merge 3 commits into
open-telemetry:mainfrom
ash-thakur-rh:features/fe-config-spi
Open

ash-thakur-rh wants to merge 3 commits into
open-telemetry:mainfrom
ash-thakur-rh:features/fe-config-spi

Conversation

@ash-thakur-rh

@ash-thakur-rh ash-thakur-rh commented Oct 28, 2026 •

Copy link
Copy Markdown

Description:

  • Added a dedicated declarative-config-spi module for the mapper and YAML parser interfaces.
  • Added the Jackson 2 mapper as a runtime dependency so it is available by default.
  • Documented how to exclude the Jackson 2 mapper and register a custom mapper, such as one using Jackson 3.
  • Updated OSGi metadata and integration coverage for declarative configuration.
  • Updated the declarative configuration README and changelog.
  • Verified the affected declarative config, autoconfigure, API incubator, Graal, and OSGi test suites. Will fix other if there are other test failures.
  • Did a manual end-to-end check in a local consumer project, excluded the Jackson 2 adapter, registered a Jackson 3 mapper through ServiceLoader, and verified configuration parsing and mapping.

Closes #8820

Add parser and mapper SPIs, and move the Jackson 2 mapper into an
optional adapter module.

Signed-off-by: Ashish Thakur <ashishth@redhat.com>
Signed-off-by: Ashish Thakur <ashishth@redhat.com>
@linux-foundation-easycla

linux-foundation-easycla Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

CLA Signed
The committers listed above are authorized under a signed CLA.

@opentelemetry-pr-dashboard

opentelemetry-pr-dashboard Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Pull request dashboard status

Waiting on the author · refreshed 2026-11-03 23:06 UTC

Respond to 6 review items (e.g. link a commit, explain why not, ask a follow-up):

  • Inline threads: 1, 2, 3, 4, 5, 6
Status above doesn't look right?
  • Just replied or pushed? Anything around or after the refresh time above may not be picked up yet — give it a few minutes.
  • Should this be with reviewers? Comment /dashboard route:reviewers to route it to them.
  • Anything wrong — including the routing? Report it with what you expected; it helps us improve the dashboard.

@codecov

codecov Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 94.49541% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.34%. Comparing base (ba0ba04) to head (93ffc5d).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...g/internal/DeclarativeConfigurationMapperUtil.java 50.00% 4 Missing ⚠️
...ernal/SnakeYamlDeclarativeConfigurationParser.java 98.70% 1 Missing ⚠️
...veconfig/model/internal/ExtensionPropertyUtil.java 75.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #8983      +/-   ##
============================================
+ Coverage     90.31%   90.34%   +0.02%     
- Complexity    10981    10997      +16     
============================================
  Files          1019     1023       +4     
  Lines         30072    30098      +26     
  Branches       3927     3928       +1     
============================================
+ Hits          27160    27192      +32     
+ Misses         1952     1944       -8     
- Partials        960      962       +2     

☔ View full report in Codecov by Harness.
📢 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.

Signed-off-by: Ashish Thakur <ashishth@redhat.com>
@ash-thakur-rh

ash-thakur-rh commented Oct 28, 2026 •

Copy link
Copy Markdown
Author

CLA Not Signed

CLA will be soon added to my account.

@ash-thakur-rh
ash-thakur-rh marked this pull request as ready for review October 29, 2026 05:26
@ash-thakur-rh
ash-thakur-rh requested a review from a team as a code owner October 29, 2026 05:26

@jack-berg jack-berg 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.

This is pretty close to the shape I imagined. Couple of things to think through tho.

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.

Hey let's put these in sdk-extensions/autoconfigure-spi in the io.opentelemetry.sdk.autoconfigure.spi.internal package. That's where ComponentProvider lives, which is another key SPI for declarative config. In #8981 we're promoting ComponentProvider to be stable and it will live in io.opentelemetry.sdk.autoconfigure.spi.declarativeconfig as its permanent home.

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.

Better to include the jackson major version number in the module name. I.e. declarative-config-jackson2. We learned the hard was with okhttp sender that people have a real problem with major version updates with these kind of load bearing dependencies. Embedding the major version gives us flexibility to maintain two versions at the same time to keep everyone happy. Can of course start without the version in the name and rename to declarative-config-jackson3 if/when needed, but its a nice visual queue to start with.

Also put the major version in the package name, i.e. io.opentelemetry.sdk.autoconfigure.declarativeconfig.jackson2.

@@ -0,0 +1,16 @@
plugins {
id("otel.java-conventions")
id("otel.publish-conventions")

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
id("otel.publish-conventions")
id("otel.publish-conventions")
id("otel.animalsniffer-conventions")

* Converts parsed configuration values to declarative configuration models and generic maps.
*
* <p>Implementations are discovered with {@link java.util.ServiceLoader}. The implementation with
* the highest {@link #order()} is used. The Jackson 2 implementation is supplied by the {@code

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.

The typical pattern we use is:

  • If exactly one is on the class path, use it
  • If two are on the class path, and the user hasn't selected one via env var / system property, log a warning and use the first we find
  • If two are on the class path, and the user has selected one via env var / system property, use it

See https://github.com/open-telemetry/opentelemetry-java/blob/main/exporters/common/src/main/java/io/opentelemetry/exporter/internal/SenderUtil.java

* This class is internal and is hence not for public use. Its APIs are unstable and can change at
* any time.
*/
public final class SnakeYamlDeclarativeConfigurationParser

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.

Interesting.. so we have a dedicated jackson module, but build the snakeyaml implementation into declarative-config directly despite it being pluggable via SPI.

I think we need to think this through and be consistent.

Comment thread CHANGELOG.md
* Declarative config: Add parser and mapper SPIs in a dedicated artifact for issue
[#8820](https://github.com/open-telemetry/opentelemetry-java/issues/8820). Include the Jackson 2
mapper by default through a runtime adapter that can be excluded to register a custom mapper such
as one based on Jackson 3.

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.

No need for changelog entries. These are generated as part of release notes.

This branch has not been deployed

No deployments
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.

Make declarative config YAML parsing and object mapping requirements pluggable via SPI

2 participants