Skip to content

[configoptional] Allow wrapping scalar values#15175

Open
evan-bradley wants to merge 24 commits into
open-telemetry:mainfrom
evan-bradley:configoptional-scalars-revived
Open

[configoptional] Allow wrapping scalar values#15175
evan-bradley wants to merge 24 commits into
open-telemetry:mainfrom
evan-bradley:configoptional-scalars-revived

Conversation

@evan-bradley
Copy link
Copy Markdown
Contributor

Description

Allow configoptional.Optional to wrap scalar values using new interfaces designed specifically to handle similar wrappers around scalar values.

Follow up to #13524.

@evan-bradley evan-bradley force-pushed the configoptional-scalars-revived branch from 521f5fd to 495f28d Compare April 22, 2026 15:49
@evan-bradley
Copy link
Copy Markdown
Contributor Author

Leaving in draft while I resolve a bunch of rebase issues and prepare follow-up PRs to show this in use.

Copy link
Copy Markdown
Contributor

@jade-guiton-dd jade-guiton-dd left a comment

Choose a reason for hiding this comment

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

Some first reactions

Comment thread confmap/xconfmap/scalarunmarshaler.go Outdated
Comment thread confmap/xconfmap/scalarunmarshaler.go Outdated
Comment thread config/configoptional/optional.go Outdated
Comment thread confmap/internal/decoder.go Outdated
@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented Apr 23, 2026

Merging this PR will not alter performance

⚠️ Unknown Walltime execution environment detected

Using the Walltime instrument on standard Hosted Runners will lead to inconsistent data.

For the most accurate results, we recommend using CodSpeed Macro Runners: bare-metal machines fine-tuned for performance measurement consistency.

✅ 7 untouched benchmarks
⏩ 76 skipped benchmarks1


Comparing evan-bradley:configoptional-scalars-revived (2048001) with main (495f2c5)

Open in CodSpeed

Footnotes

  1. 76 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 23, 2026

Codecov Report

❌ Patch coverage is 87.20930% with 11 lines in your changes missing coverage. Please review.
✅ Project coverage is 91.19%. Comparing base (91b32ef) to head (2048001).
⚠️ Report is 15 commits behind head on main.

Files with missing lines Patch % Lines
confmap/internal/scalar.go 88.88% 3 Missing and 2 partials ⚠️
config/configoptional/optional.go 90.00% 1 Missing and 1 partial ⚠️
confmap/internal/marshaloption.go 66.66% 1 Missing and 1 partial ⚠️
confmap/internal/unmarshaloption.go 66.66% 1 Missing and 1 partial ⚠️

❌ Your patch check has failed because the patch coverage (87.20%) is below the target coverage (95.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #15175      +/-   ##
==========================================
- Coverage   91.23%   91.19%   -0.04%     
==========================================
  Files         703      705       +2     
  Lines       45902    45998      +96     
==========================================
+ Hits        41878    41950      +72     
- Misses       2820     2837      +17     
- Partials     1204     1211       +7     

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

Copy link
Copy Markdown
Member

@mx-psi mx-psi left a comment

Choose a reason for hiding this comment

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

This looks reasonable to me and I think we have enough leeway to modify things that I feel comfortable moving forward with it now

@evan-bradley evan-bradley marked this pull request as ready for review May 8, 2026 20:04
@evan-bradley evan-bradley requested a review from a team as a code owner May 8, 2026 20:04
@evan-bradley evan-bradley requested a review from atoulme May 8, 2026 20:04
@evan-bradley
Copy link
Copy Markdown
Contributor Author

I looked this over again and I think it's ready for a review now.

Copy link
Copy Markdown
Contributor

@jade-guiton-dd jade-guiton-dd left a comment

Choose a reason for hiding this comment

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

The approach seems good overall

Comment thread .chloggen/xconfmap-scalars.yaml Outdated
Comment thread .chloggen/configoptional-scalars.yaml Outdated
Comment thread config/configoptional/optional.go Outdated
Comment thread confmap/xconfmap/scalarunmarshaler.go Outdated
Comment thread confmap/internal/decoder.go Outdated
Comment thread confmap/xconfmap/scalarmarshaler.go Outdated
Comment thread config/configoptional/optional.go Outdated
@evan-bradley evan-bradley force-pushed the configoptional-scalars-revived branch 2 times, most recently from 433357b to f58565d Compare May 11, 2026 19:31
@evan-bradley evan-bradley force-pushed the configoptional-scalars-revived branch from f58565d to 1faf1b6 Compare May 11, 2026 20:14
Copy link
Copy Markdown
Contributor

@jade-guiton-dd jade-guiton-dd left a comment

Choose a reason for hiding this comment

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

Almost good, mostly just nits, just one concern about the behavior of scalarValue.Marshal(nil)

Comment thread config/configoptional/optional.go Outdated
Comment thread config/configoptional/optional.go
Comment thread confmap/internal/scalar.go Outdated
Comment thread confmap/internal/scalar.go Outdated
Comment thread confmap/internal/decoder.go Outdated
Comment thread confmap/internal/scalar.go
Comment thread confmap/internal/scalar.go
Comment thread confmap/confmap.go
evan-bradley and others added 6 commits May 12, 2026 08:04
Co-authored-by: Jade Guiton <jade.guiton@datadoghq.com>
Co-authored-by: Jade Guiton <jade.guiton@datadoghq.com>
Co-authored-by: Jade Guiton <jade.guiton@datadoghq.com>
Copy link
Copy Markdown
Contributor

@jade-guiton-dd jade-guiton-dd left a comment

Choose a reason for hiding this comment

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

Sorry for all the nitpicks, good work!

@evan-bradley evan-bradley force-pushed the configoptional-scalars-revived branch from 05b8d8a to ca2cb4c Compare May 12, 2026 18:16
@evan-bradley
Copy link
Copy Markdown
Contributor Author

evan-bradley commented May 12, 2026

Thank you! And really appreciate your careful reviews, your points led to a lot of meaningful improvements.

@evan-bradley evan-bradley force-pushed the configoptional-scalars-revived branch from ca2cb4c to 2048001 Compare May 12, 2026 18:18
Copy link
Copy Markdown
Member

@mx-psi mx-psi left a comment

Choose a reason for hiding this comment

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

Re-approving after reading the convo above, thanks Jade for the careful review ❤️

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.

3 participants