-
Notifications
You must be signed in to change notification settings - Fork 249
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
Assert correct elements are removed from hashes larger than limit. #1535
Assert correct elements are removed from hashes larger than limit. #1535
Conversation
|
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.
This is technically incorrect. From #1533 (comment)
Followup: the W3C
trace-context
spec states:In a situation where
tracestate
needs to be truncated due to size limitations, the vendor MUST truncate whole entries. Entries larger than 128 characters long SHOULD be removed first. Then entries SHOULD be removed starting from the end oftracestate
. Note that other truncation strategies like safe list entries, blocked list entries, or size-based truncation MAY be used, but are highly discouraged. Those strategies decrease the interoperability of various tracing vendors.
Our implementation is wrong and we should remove entries from the end rather than the start (and, of course, we should remove entries > 128 characters first).
I'll close, thanks Bogs. |
😞 I was kinda hoping you'd fix the test and then we could fix the implementation 😄 |
@ptolts could you please click the link in #1535 (comment) to authorize the CLA? |
tracestate = OpenTelemetry::Trace::Tracestate.from_hash(input_hash) | ||
output_hash = tracestate.to_h | ||
_(output_hash.size).must_be :<=, 32 | ||
_(output_hash).must_equal(input_hash.drop(1).to_h) |
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.
_(output_hash).must_equal(input_hash.drop(1).to_h) | |
_(output_hash).must_equal(input_hash.first(32).to_h) |
Hi, @ptolts! Checking in on this PR. Would you be open to signing the CLA? |
👋 This pull request has been marked as stale because it has been open with no activity. You can: comment on the issue or remove the stale label to hold stale off for a while, add the |
Adds missing test coverage for Tracestates larger than 32.