-
Notifications
You must be signed in to change notification settings - Fork 1.7k
[configgrpc, confighttp] Support lists of name/value pairs for headers #13996
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
[configgrpc, confighttp] Support lists of name/value pairs for headers #13996
Conversation
Codecov Report❌ Patch coverage is
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. 🚀 New features to boost your workflow:
|
There was a problem hiding this 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 👍🏻
#### 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.
Next steps:
|
Description
This PR introduces:
MapList[T]
type, which is equivalent to[]{ Name string, Value T }
, but can be unmarshalled from amap[string]T
as well. This type is defined in a newinternal/maplist
package.configopaque.MapList
configgrpc
andconfighttp
are changed to use this type instead ofmap[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
.