From 15cc6fb59579655f5aae898676fd11994c7fbb8b Mon Sep 17 00:00:00 2001 From: Alex Hall Date: Thu, 5 Dec 2024 17:11:38 +0200 Subject: [PATCH] Re-seed random ID generator after `os.fork()` (#644) --- logfire/_internal/utils.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/logfire/_internal/utils.py b/logfire/_internal/utils.py index 1c019fbe2..d5cabc4bc 100644 --- a/logfire/_internal/utils.py +++ b/logfire/_internal/utils.py @@ -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)