Make UUID generation lazy by sl0thentr0py · Pull Request #2826 · getsentry/sentry-python
note that we also have uuid generation on scope.propagation_context now and to make that lazy we first need to encapsulate propagation_context in a class and not just a raw dict as currently implemented.
| def _create_new_propagation_context(self): | |
| # type: () -> Dict[str, Any] | |
| return { | |
| "trace_id": uuid.uuid4().hex, | |
| "span_id": uuid.uuid4().hex[16:], | |
| "parent_span_id": None, | |
| "dynamic_sampling_context": None, | |
| } |
Without also making those lazy, this will not really have a performance impact but we can merge it anyway.