Description
Description
According to section 3 of the W3C Baggage spec:
Multiple baggage headers are allowed. Values can be combined in a single header according to RFC 7230.
Section 3.4 gives this example:
Context might be split into multiple headers:
baggage: userId=alice baggage: serverNode=DF%2028,isProduction=false
But the baggage propagator's Extract() method ends up using https://pkg.go.dev/net/http#Header.Get rather than https://pkg.go.dev/net/http#Header.Values, so it is only able to get a single header value. For the example above (which I've reproduced in the test below) it only sees the key-value pair for userId=alice
, and not the other two.
I'm not sure if there are other, better, ways to do this but in my test I am using a HeaderCarrier to adapt http.Header to a TextMapCarrier. This only has a Get() method in the interface, no Values():
opentelemetry-go/propagation/propagation.go
Lines 11 to 30 in 7846383
If it's important to avoid changing the TextMapCarrier interface, then perhaps the HeaderCarrier.Get() method could join together multiple header values into a single comma-separated string?
Environment
- OS: Fedora 41
- Architecture: amd64
- Go Version: 1.23.4
- opentelemetry-go version: v1.33.0
Steps To Reproduce
- Run https://goplay.tools/snippet/1DWw9PC4tHr
- See error
Expected behavior
I expected all the tests to pass, and for the values of userId
, serverNode
and isProduction
to be alice
, DF%2028
and false
, respectively.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Needs triage