Skip to content

Conversation

jade-guiton-dd
Copy link
Contributor

@jade-guiton-dd jade-guiton-dd commented Oct 10, 2025

Description

This PR introduces:

  • A generic MapList[T] type, which is equivalent to []{ Name string, Value T }, but can be unmarshalled from a map[string]T as well. This type is defined in a new internal/maplist package.
  • A specialized version exported as configopaque.MapList

configgrpc and confighttp are changed to use this type instead of map[string]configopaque.String for storing header configuration, so as to be consistent with the SDK declarative config (see tracking issue).

Note that while this is relatively elegant, it causes a number of breaking changes. An alternative would be to keep the current map[string]configopaque.String types, and add an Unmarshal method on the surrounding struct: see this PoC.

Link to tracking issue

Fixes #13930

Testing

I added a basic unit test in internal/maplist.

Copy link

codecov bot commented Oct 10, 2025

Codecov Report

❌ Patch coverage is 96.55172% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 91.64%. Comparing base (47f63a8) to head (aa534ad).
⚠️ Report is 40 commits behind head on main.

Files with missing lines Patch % Lines
config/configopaque/opaque.go 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #13996      +/-   ##
==========================================
- Coverage   91.67%   91.64%   -0.03%     
==========================================
  Files         654      655       +1     
  Lines       42663    42669       +6     
==========================================
- Hits        39111    39105       -6     
- Misses       2738     2749      +11     
- Partials      814      815       +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.

Copy link
Contributor

@codeboten codeboten left a comment

Choose a reason for hiding this comment

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

i think this is the right approach 👍🏻

songy23 pushed a commit to open-telemetry/opentelemetry-collector-contrib that referenced this pull request Oct 15, 2025
#### Description

#43509 changed the `make for-all` Makefile target to access the
`ALL_MODS` variable through environment variables instead of expanding
it into the shell command, in order to bypass Windows' 8192 byte command
line length limit.

However, the environment variable was not defined, which led to `make
for-all` becoming a no-op. This can be confirmed by running `make
for-all CMD='echo test'`.

(I discovered this issue because [this
PR](open-telemetry/opentelemetry-collector#13996)
in core repository, which should be failing `contrib-tests`, suddenly
started passing them. This was because the job inserts `replace`
statements in a copy of contrib using `for-all`; failing to do that
caused the contrib tests to run against whatever version of core is
imported here rather than against the PR's code.)

This PR fixes that oversight, by adding the `export` keyword to the
`ALL_MODS` variable.
@jade-guiton-dd
Copy link
Contributor Author

jade-guiton-dd commented Oct 16, 2025

Next steps:

  • File a draft PR in contrib with the corresponding changes, so the breakage can be fixed quickly
  • Mark this as ready for review
  • File a follow-up issue about deprecating and eventually removing the "map" behavior

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[configgrpc, confighttp] update headers to array of name/value pairs to match configuration schema

2 participants