Skip to content

Conversation

@zeitlinger
Copy link
Member

@codecov
Copy link

codecov bot commented Dec 16, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.13%. Comparing base (e3a377d) to head (b7ebfeb).
⚠️ Report is 4 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##               main    #7923   +/-   ##
=========================================
  Coverage     90.12%   90.13%           
- Complexity     7318     7320    +2     
=========================================
  Files           824      824           
  Lines         22027    22028    +1     
  Branches       2177     2177           
=========================================
+ Hits          19852    19854    +2     
  Misses         1498     1498           
+ Partials        677      676    -1     

☔ 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.

*
* @return a map-valued configuration property, or an empty {@link DeclarativeConfigProperties}
* instance if {@code name} has not been configured
* @throws DeclarativeConfigException if the property is not a mapping
Copy link
Member

Choose a reason for hiding this comment

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

wdyt of not throwing exception for this (and other) methods which have default values?

Copy link
Member

Choose a reason for hiding this comment

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

If we took this approach I think we'd want to go further and get rid of the the throws altogether. It would be strange if calling the non-default overload threw (rather than just returning null) while the default did not.

Going in this direction means we remove the ability to detect / handle schema type mismatches. It seems like a version of the "fail fast" vs. "handle gracefully and trudge on".

But hold on... the default YamlDeclarativeConfigProperties implementation does warn you if there is a type mismatch, but never throws! So all of these warnings are fake!

I do wonder if we should provide abilities to detect schema type mismatches and fail fast. API could look like:

boolean isStringOrNull(String name);
boolean isBooleanOrNull(String name);

Copy link
Member

Choose a reason for hiding this comment

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

Discussed in the 12/18 java SIG and decided that:

  • The opentelemetry-java-instrumentation has a preference for failing graceful (at least for now - we discussed both options in detail)
  • We should work to create actionable warning logs if the a config property type mismatch occurs.
    • Current error messages only use the local context of the node. I.e. Ignoring value for key [foo] because it is String instead of Integer: value
    • Good error messages would include the full path Ignoring value for property [full.path.to.foo] because it is String instead of Integer: value
  • It would be good to still allow for instrumentation libraries to fail fast. If the API defaults to leniency, then we'd need to provide additional APIs for facilitate this. Can add these when needed.

The work to strip out the @throws DeclarativeConfigException to reflect current behavior, and to improve error log messages can be done in separate PRs.

zeitlinger and others added 2 commits December 17, 2025 18:32
…fig/DeclarativeConfigProperties.java

Co-authored-by: Jack Berg <[email protected]>
Copy link
Member

@jack-berg jack-berg left a comment

Choose a reason for hiding this comment

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

I'm not completely convinced that the method name get implies that I'm asking for a structured node back. Can't think of any better names that keep good UX, and the javadoc provides details, so let's just go ahead with this.

@jack-berg jack-berg merged commit 22d90b6 into open-telemetry:main Dec 18, 2025
44 of 46 checks passed
@zeitlinger zeitlinger deleted the declarative-config-get branch December 19, 2025 06:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

3 participants