open-telemetry / opentelemetry-python

OpenTelemetry Python API and SDK
https://opentelemetry.io
Apache License 2.0
1.67k stars 569 forks source link

RandomIdGenerator can generate invalid Span/Trace Ids #3921

Closed sfc-gh-bdrutu closed 2 weeks ago

sfc-gh-bdrutu commented 1 month ago

Describe your environment Describe any aspect of your environment relevant to the problem, including your Python version, platform, version numbers of installed dependencies, information about your cloud hosting provider, etc. If you're reporting a problem with a specific version of a library in this repo, please check whether the problem has been fixed on main. latest

Steps to reproduce You need to be very "lucky" to do so, but call billions of times generate_span_id until you get a ZERO value. Same issue may happen for generate_trace_id

What is the expected behavior? Never receive an invalid Span/Trace ID from the generator (ZERO value).

What is the actual behavior? Invalid IDs may happen.

Additional context Add any other context about the problem here.

Charlie-lizhihan commented 1 month ago

Hi, beginner here, can I try to work on this?