We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 65e667c commit ad47675Copy full SHA for ad47675
1 file changed
sentry_sdk/traces.py
@@ -5,6 +5,12 @@
5
sentry_sdk.init(_experiments={"trace_lifecycle": "stream"}).
6
"""
7
8
+import uuid
9
+from typing import TYPE_CHECKING
10
+
11
+if TYPE_CHECKING:
12
+ from typing import Optional
13
14
15
class StreamedSpan:
16
@@ -16,4 +22,18 @@ class StreamedSpan:
22
span implementation lives in tracing.Span.
17
23
18
24
19
- pass
25
+ __slots__ = ("_trace_id",)
26
27
+ def __init__(
28
+ self,
29
+ *,
30
+ trace_id: "Optional[str]" = None,
31
+ ):
32
+ self._trace_id = trace_id
33
34
+ @property
35
+ def trace_id(self) -> str:
36
+ if not self._trace_id:
37
+ self._trace_id = uuid.uuid4().hex
38
39
+ return self._trace_id
0 commit comments