-
Notifications
You must be signed in to change notification settings - Fork 217
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
fix(baggage): Update baggage parsing and encoding in vendored otel package #568
Conversation
Codecov ReportBase: 74.72% // Head: 79.13% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## master #568 +/- ##
==========================================
+ Coverage 74.72% 79.13% +4.40%
==========================================
Files 38 38
Lines 3838 3853 +15
==========================================
+ Hits 2868 3049 +181
+ Misses 850 703 -147
+ Partials 120 101 -19
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
@@ -12,6 +12,7 @@ require ( | |||
github.com/pingcap/errors v0.11.4 | |||
github.com/pkg/errors v0.9.1 | |||
github.com/sirupsen/logrus v1.9.0 | |||
github.com/stretchr/testify v1.8.0 |
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.
testify
is currently used only in baggage_test.go
, and also used by a bunch of dependencies.
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.
Nice! Maybe we can give it another try by opening this as a PR on the Otel repo.
These changes to
baggage.go
fix a few issues that are happening now in violation of the baggage spec (or at least my understanding of it):one%20two
should be properly parsed as "one two"one+two
should be parsed as "one+two"one%20two
(percent encoding), and NOT asone+two
(URL query encoding).1=1
(the spec says: "Note, value MAY contain any number of the equal sign (=) characters. Parsers MUST NOT assume that the equal sign is only used to separate key and value.").1%3D1
is also valid, but to simplify the implementation we're not doing it.Notes
baggage_test.go
was copied from opentelemetry-go, commit 5e8eb855bf3c6507715edd12ded5c6a950dd6104.Case number 2 is not fully fixed right now: baggage string valueone+two
will be parsed as "one two", and not as "one+two". To fix that,url.QueryUnescape()
should be replaced by a function with the logic compatible withpercentEncodeValue()
, where the plus (and other allowed characters) are not treated as something special.Fixes #554.