Skip to content

Commit

Permalink
Re-seed random ID generator after os.fork() (#644)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexmojaki authored Dec 5, 2024
1 parent e793014 commit 15cc6fb
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions logfire/_internal/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,8 @@ class SeededRandomIdGenerator(IdGenerator):

def __post_init__(self) -> None:
self.random = random.Random(self.seed)
if self.seed is None:
os.register_at_fork(after_in_child=self.random.seed)

def generate_span_id(self) -> int:
span_id = self.random.getrandbits(64)
Expand Down

0 comments on commit 15cc6fb

Please sign in to comment.