-
Notifications
You must be signed in to change notification settings - Fork 786
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
Changed TraceIdRatioBasedSampler.GetLowerLong to use the correct bytes for sampling decision #5707
Conversation
…s for sampling decision
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.
looks good to me...
This could be a breaking change, even though the algorithm in TraceIdRatioSampler was never fixed and not spec-ed out either. Do you know if the spec issue for the same is worked on by anyone actively? |
Not that I'm aware of. |
@AsakerMohd - Looks like the spec already has TODO for this. I think we could just wait for that rather than changing it now only to adjust it again later. (if the final state is different than proposed in this PR). |
I have added this for discussion for our next SIG meeting. https://docs.google.com/document/d/1yjjD6aBcLxlRazYrawukDgrhZMObwHARJbB9glWdHj8/edit Feel free to join. |
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. |
Changes
Changed TraceIdRatioBasedSampler.GetLowerLong to use the correct bytes for sampling decision. Previously it was using the first 8 bytes to base the sampling decision on. Byte 0 in this case is the most significant byte not the least significant byte. As a result, changed it to use bytes 8->16 as those are the actual
LowerLong
. I discovered this while testing the with XrayIds where the first 4 bytes aren't random (based on current timestamp). Looking at this issue, open-telemetry/opentelemetry-specification#1413 (comment), seems like we're supposed to use the last 8 bytes to maintain compatibility with 64-bit TraceIds since those are random. I also looked at the Python Implementation and the Java Implementaiton of the TraceIdRatioBasedSampler and they both also seem to be using the last 8 bytes (least significant 8 bytes to byte 8->15 where byte 0 is the most significant byte).Testing:
I created a sample app and copied over the sampling code to verify that the bytes being used currently are the most significant bytes and this was the result:
Merge requirement checklist
CHANGELOG.md
files updated for non-trivial changes