Skip to content

Avoid false type warnings in DeclarativeConfigPropertyUtil.toMap - #8921

Merged
jack-berg merged 1 commit into
open-telemetry:mainfrom
thswlsqls:fix/declarative-config-tomap-type-warnings
Oct 9, 2026
Merged

jack-berg merged 1 commit into
open-telemetry:mainfrom
thswlsqls:fix/declarative-config-tomap-type-warnings

Conversation

@thswlsqls

Copy link
Copy Markdown
Contributor

Fixes #8919

Description

  • DeclarativeConfigPropertyUtil.toMap found each value's type by calling getString, getBoolean, getLong and getDouble in turn. YamlDeclarativeConfigProperties logs Ignoring value for key [...] for each mismatched call, so valid values like ratio: 0.25 or enabled: true produced false warnings.
  • The four scalar resolvers now check isString/isBoolean/isLong/isDouble first. These match the types each getter accepts, so the resulting map is unchanged (integers are still returned as Long).
  • Reached via jaeger_remote.initial_sampler and InstrumentationConfigUtil.getInstrumentationConfigModel.
  • Not covered: lists of numbers or booleans still warn per element in getScalarList, because there is no list introspection API.
  • Related: Add type introspection to DeclarativeConfigProperties #8883 (added the is<Type> methods), DeclarativeConfigProperties: no way to coerce types without triggering warnings #8101.

Testing done

  • Added DeclarativeConfigPropertyUtilTest#toMap_doesNotLogTypeWarnings (string, boolean, integer, double, nested map, string list, list of maps): asserts map values and types, and that no YamlDeclarativeConfigProperties warnings are logged.
  • With the production change reverted, the test fails (14 warnings logged).
  • ./gradlew :api:incubator:check passed (98 tests in test, 4 in testConvertToModel).

@thswlsqls
thswlsqls marked this pull request as ready for review October 9, 2026 01:30
@thswlsqls
thswlsqls requested a review from a team as a code owner October 9, 2026 01:30
@codecov

codecov Bot commented Oct 9, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.64%. Comparing base (49dd9f3) to head (085bb26).

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #8921      +/-   ##
============================================
+ Coverage     90.62%   90.64%   +0.01%     
- Complexity    10876    10879       +3     
============================================
  Files          1015     1015              
  Lines         29712    29720       +8     
  Branches       3874     3874              
============================================
+ Hits          26927    26939      +12     
+ Misses         1868     1863       -5     
- Partials        917      918       +1     

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

@opentelemetry-pr-dashboard

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

Copy link
Copy Markdown

Pull request dashboard status

Merged · refreshed 2026-10-09 16:21 UTC

Status above doesn't look right?
  • Anything look wrong? Report it with what you expected; it helps us improve the dashboard.

@jack-berg
jack-berg merged commit af63c05 into open-telemetry:main Oct 9, 2026
35 checks passed
@otelbot

otelbot Bot commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

Thank you for your contribution @thswlsqls! 🎉 We would like to hear from you about your experience contributing to OpenTelemetry by taking a few minutes to fill out this survey.

@thswlsqls
thswlsqls deleted the fix/declarative-config-tomap-type-warnings branch October 18, 2026 12:28
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.

DeclarativeConfigProperties.toMap logs false type warnings for valid values

2 participants