Skip to content

[configoptional] Allow wrapping scalar values#15175

Merged
evan-bradley merged 24 commits into
open-telemetry:mainfrom
evan-bradley:configoptional-scalars-revived
May 19, 2026
Merged

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

Conversation

@evan-bradley

Copy link
Copy Markdown
Member

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
Member Author

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

@jade-guiton-dd jade-guiton-dd 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.

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

codspeed-hq Bot commented Apr 23, 2026

Copy link
Copy Markdown

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

codecov Bot commented Apr 23, 2026

Copy link
Copy Markdown

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

@mx-psi mx-psi 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 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
Member Author

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

@jade-guiton-dd jade-guiton-dd 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.

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

@jade-guiton-dd jade-guiton-dd 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.

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

@jade-guiton-dd jade-guiton-dd 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.

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

evan-bradley commented May 12, 2026

Copy link
Copy Markdown
Member Author

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

@mx-psi mx-psi 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.

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

@mx-psi mx-psi linked an issue May 19, 2026 that may be closed by this pull request
@evan-bradley
evan-bradley added this pull request to the merge queue May 19, 2026
Merged via the queue into open-telemetry:main with commit 6fe6256 May 19, 2026
65 of 66 checks passed
@evan-bradley
evan-bradley deleted the configoptional-scalars-revived branch May 19, 2026 14:24
jkoronaAtCisco pushed a commit to jkoronaAtCisco/opentelemetry-collector that referenced this pull request May 20, 2026
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description

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

Follow up to
open-telemetry#13524.

---------

Co-authored-by: Jade Guiton <[email protected]>
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.

[configoptional] Define direction in scalar values support

3 participants