-
Notifications
You must be signed in to change notification settings - Fork 770
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] baggage item value encoding fix - custom encoder #5292
Conversation
@@ -94,7 +94,7 @@ public override void Inject<T>(PropagationContext context, T carrier, Action<T, | |||
continue; | |||
} | |||
|
|||
baggage.Append(WebUtility.UrlEncode(item.Key)).Append('=').Append(WebUtility.UrlEncode(item.Value)).Append(','); | |||
baggage.Append(W3CBaggageValueEncoder.Encode(item.Key)).Append('=').Append(W3CBaggageValueEncoder.Encode(item.Value)).Append(','); |
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.
Baggage item keys should meet token
requirement from the specification, and not be encoded.
I can address that in a separate PR.
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #5292 +/- ##
==========================================
- Coverage 83.38% 83.08% -0.31%
==========================================
Files 297 273 -24
Lines 12531 12011 -520
==========================================
- Hits 10449 9979 -470
+ Misses 2082 2032 -50
Flags with carried forward coverage won't be shown. Click here to find out more.
|
I haven't got time to look into this PR. Here is my general feedback:
|
There is a section in OpenTelemetry Baggage Spec related to propagation that references W3C Baggage Specification.
Code comment mentions editor's draft. |
This PR was marked stale due to lack of activity and will be closed in 7 days. Commenting or Pushing will instruct the bot to automatically remove the label. This bot runs once per day. |
Closed as inactive. Feel free to reopen if this PR is still being worked on. |
Fixes #5260
Changes
Fixes encoding of
' '
char in baggage item values when injecting baggage.Adds custom encoder, based on
WebUtility.Encode
from runtime repository, with modifications related to space character encoding.Additionally, only characters required by the specification are percent-encoded, which results in minimal, compliant representation.
This is important considering baggage limits.
The need for the shortest, compliant representation expressed in #2012 (comment)
Alternatives:
Use
Uri.EscapeDataString
which correctly encodes spaces. The downside of this approach is many characters not required to be percent-encoded by the specification are percent-encoded.Merge requirement checklist
CHANGELOG.md
files updated for non-trivial changes