You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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():
// TextMapCarrier is the storage medium used by a TextMapPropagator.
typeTextMapCarrierinterface {
// DO NOT CHANGE: any modification will not be backwards compatible and
// must never be done outside of a new major release.
// Get returns the value associated with the passed key.
Get(keystring) string
// DO NOT CHANGE: any modification will not be backwards compatible and
// must never be done outside of a new major release.
// Set stores the key-value pair.
Set(keystring, valuestring)
// DO NOT CHANGE: any modification will not be backwards compatible and
// must never be done outside of a new major release.
// Keys lists the keys stored in this carrier.
Keys() []string
// DO NOT CHANGE: any modification will not be backwards compatible and
// must never be done outside of a new major release.
}
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?
Description
According to section 3 of the W3C Baggage spec:
Section 3.4 gives this example:
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
Steps To Reproduce
Expected behavior
I expected all the tests to pass, and for the values of
userId
,serverNode
andisProduction
to bealice
,DF%2028
andfalse
, respectively.The text was updated successfully, but these errors were encountered: