-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
baggage: Accept non-ASCII keys #4946
Comments
I need help here. The blank space p, err := NewKeyProperty(" ")
assert.NoError(t, err) The following case also became available that {
name: "encoded UTF-8 string in key",
in: "%C4%85%C5%9B%C4%87=%C4%85%C5%9B%C4%87",
want: baggage.List{
"ąść": {Value: "ąść"},
},
}, Do you think these cases should be considered valid cases? @pellared |
This is a valid correct test as it touches the Baggage API (not propagator).
Right now, the specification for W3C baggage propagator does NOT support percent encoding of the key. From https://www.w3.org/TR/baggage/#key:
Alternatively, the W3C baggage specification could allow percent encoding of the keys. CC @yurishkuro @dyladan |
Percent encoding of keys is something that has been considered and rejected by W3C. Worth noting that there is nothing stopping an implementation from doing it; all the required characters are allowed. If the w3c specification added it though, it creates a lot of questions. For example, if you have an entry for |
I think it is better (safer) not doing as the implementations (e.g. in other languages) may not percent-decode the keys. This may lead to unpredictable behavior. @dyladan, does it make sense? |
I didn't mean go should do it. I meant the otel spec could do it if desired then all languages would do it consistently |
From baggage spec:
It mentions the baggage could accept any valid UTF-8 as a key but not for the W3C baggage propagator. So, I guess we can implement UTF-8 in baggage API but drop the key with UTF-8 in the W3C baggage propagator. |
The spec allows any UTF8 strings as baggage keys, case sensitive. It already recommends these unit tests for Baggage API:
I would add two more tests where the key itself contains an emoji or the key is a space - both are valid. For the W3C propagator, there is already a written compatibility test: https://github.com/w3c/baggage/blob/main/test/test_baggage.py. One thing that's seems missing there is the handling of malformed inputs (I booked w3c/baggage#131) |
I do not think it should be done especially that |
Per open-telemetry/opentelemetry-specification#3801
The new wording makes Go implementation non-compliant, but it's not a breaking change for its API, you will just need to relax the checks (i.e. never return errors from
baggage.New
)Originally posted by @yurishkuro in open-telemetry/opentelemetry-specification#3801 (comment)
The text was updated successfully, but these errors were encountered: