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

When the random seed is set, it causes duplicate traceId and spanId. #4376

Open
lyred193 opened this issue Jan 3, 2025 · 0 comments
Open
Labels
bug Something isn't working

Comments

@lyred193
Copy link

lyred193 commented Jan 3, 2025

Describe your environment

OS: ALL
Python version: Python 3.10.16
SDK version: 1.29.0

What happened?

After setting a random seed in the Python application, the traceId and spanId are duplicated after each restart of the application.

Steps to Reproduce

from opentelemetry.sdk.trace import RandomIdGenerator

if name == "main":
import random
random.seed(10)
id_generator = RandomIdGenerator()
trace_id = id_generator.generate_trace_id()
span_id = id_generator.generate_span_id()
# Every time the main function is run, the trace_id is always 164207228320579316746596838417247989971
print(trace_id)
# Every time the main function is run, the span_id is always 273610340023782072
print(span_id)

Expected Result

Each time the main function runs, the trace_id and span_id are different.

Actual Result

Every time the main function is run, the trace_id is always 164207228320579316746596838417247989971
Every time the main function is run, the span_id is always 273610340023782072

Additional context

No response

Would you like to implement a fix?

Yes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant