RUM-12495: Support trace sampling based on Session Id#169
Merged
Conversation
ambushwork
force-pushed
the
yl/trace-sampling-on-session
branch
from
June 1, 2026 06:21
f23f89a to
b231162
Compare
ambushwork
marked this pull request as ready for review
June 1, 2026 06:22
kikoveiga
reviewed
Jun 1, 2026
ambushwork
force-pushed
the
yl/trace-sampling-on-session
branch
from
June 1, 2026 11:05
b231162 to
eaa743a
Compare
This comment has been minimized.
This comment has been minimized.
ambushwork
force-pushed
the
yl/trace-sampling-on-session
branch
from
June 1, 2026 11:56
eaa743a to
868d0ef
Compare
kikoveiga
reviewed
Jun 1, 2026
ambushwork
force-pushed
the
yl/trace-sampling-on-session
branch
from
June 1, 2026 15:56
868d0ef to
679ac9a
Compare
ambushwork
force-pushed
the
yl/trace-sampling-on-session
branch
from
June 1, 2026 16:07
679ac9a to
1078724
Compare
kikoveiga
approved these changes
Jun 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Previously, each HTTP request through DdUrlTransfer made an independent random sampling decision, so two requests in the same session could get different decisions.
This change makes trace sampling deterministic per-session: the last 48 bits of the session UUID are used as a seed for the same Knuth multiplicative hash (× 1111111111111111111) used by the Android and iOS SDKs. Requests in the same session now always receive the same sampling decision, consistent with backend expectations.
When no active session is present, the previous random fallback is preserved.
Note on implementation: BrightScript's LongInteger * does not wrap on 64-bit overflow — it uses double arithmetic for large products. The Knuth multiplication is therefore implemented via 16-bit chunk decomposition to stay within safe integer range, then assembled as a double for the threshold comparison.
Review checklist (to be filled by reviewers)