open-telemetry / opentelemetry-python

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

bugfix: RandomIdGenerator can generate invalid Span/Trace Ids #3949

Closed Charlie-lizhihan closed 2 weeks ago

Charlie-lizhihan commented 3 weeks ago

Description

This PR updates the RandomIdGenerator class to ensure that it generates valid span and trace IDs by avoiding specific invalid values.

Fixes #3921

Type of change

Please delete options that are not relevant.

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

I wrote 2 new tests for this one, when it generate a invalid id(for example: 0), the generate function will run again.

Does This PR Require a Contrib Repo Change?

Checklist:

linux-foundation-easycla[bot] commented 3 weeks ago

CLA Signed

The committers listed above are authorized under a signed CLA.