Skip to content
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

ddtrace/tracer: better trace and span ID randomness #1472

Merged
merged 2 commits into from Sep 20, 2022

Conversation

ajgajg1134
Copy link
Contributor

This resolves an issue that could cause collisions due to random only using a 32 bit seed. Even though we're generating a nice cryptographically secure 64 bit seed it actually is only using 32 bits. This means that if a customer is running a large number (e.g. > 30k) of go service instances that generate spans, there is a possibility for a traceid / spanID collision.

To resolve this we XOR the generated 64 bit number with the span start time, this keeps the random numbers evenly distributed but reduces the likelihood of a collision should two instances of a service get the same random seed.

@ajgajg1134 ajgajg1134 added this to the 1.43.0 milestone Sep 20, 2022
@ajgajg1134 ajgajg1134 requested a review from a team September 20, 2022 15:49
@knusbaum knusbaum changed the title tracer: better distributed randomness ddtrace/tracer: better trace and span ID randomness Sep 20, 2022
@knusbaum knusbaum merged commit 814381c into main Sep 20, 2022
@knusbaum knusbaum deleted the andrew.glaude/RandomSeed branch September 20, 2022 17:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants