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

Consider using GetHashCode in TraceIdRatioBasedSampler? #4365

Open
pbiggar opened this issue Apr 5, 2023 · 1 comment
Open

Consider using GetHashCode in TraceIdRatioBasedSampler? #4365

pbiggar opened this issue Apr 5, 2023 · 1 comment

Comments

@pbiggar
Copy link

pbiggar commented Apr 5, 2023

I've been looking at a TraceIdRatioSampler, which has some bitwise operations to try and get a ratio from the traceID. It copies the TraceID into a span, then iterates over its lower 8 bits to get an int64.

It seems like calling GetHashCode would have the same probability distribution, and be faster?

@cijothomas
Copy link
Member

See this: open-telemetry/opentelemetry-specification#1413

I believe the current implementation is aligned with other languages, though not formally spec-ed, and changes this could have significant impact.

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

No branches or pull requests

2 participants