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

TraceIDRatioBased doesn't work with xray.NewIDGenerator #2735

Open
danilobuerger opened this issue Sep 7, 2022 · 0 comments
Open

TraceIDRatioBased doesn't work with xray.NewIDGenerator #2735

danilobuerger opened this issue Sep 7, 2022 · 0 comments
Labels
area: propagators Related to the propagators module bug Something isn't working propagator: aws:xray

Comments

@danilobuerger
Copy link

The first 4 bytes of an xray trace id are time based (https://docs.aws.amazon.com/xray/latest/devguide/xray-api-sendingdata.html#xray-api-traceids):

tid := trace.TraceID{}
currentTime := getCurrentTimeHex()
copy(tid[:4], currentTime)

When using TraceIDRatioBased, it compares the first 8 bytes to see if it should sample:

https://github.com/open-telemetry/opentelemetry-go/blob/569f7430726278f40e562f81e64d21156cc3edb9/sdk/trace/sampling.go#L84-L85

This assumes that the first 8 bytes are random, which they are not. So if the current time is above the upper bound it will never sample.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: propagators Related to the propagators module bug Something isn't working propagator: aws:xray
Projects
None yet
Development

No branches or pull requests

2 participants