divi 0.0.1b1__py3-none-any.whl → 0.0.1b2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- divi/__init__.py +1 -1
- divi/signals/span.py +5 -0
- divi/signals/trace.py +5 -0
- {divi-0.0.1b1.dist-info → divi-0.0.1b2.dist-info}/METADATA +1 -1
- {divi-0.0.1b1.dist-info → divi-0.0.1b2.dist-info}/RECORD +7 -7
- {divi-0.0.1b1.dist-info → divi-0.0.1b2.dist-info}/WHEEL +0 -0
- {divi-0.0.1b1.dist-info → divi-0.0.1b2.dist-info}/licenses/LICENSE +0 -0
divi/__init__.py
CHANGED
divi/signals/span.py
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
import atexit
|
1
2
|
import os
|
2
3
|
import time
|
3
4
|
from enum import Enum
|
@@ -62,6 +63,8 @@ class Span:
|
|
62
63
|
"""Start the span by recording the current time in nanoseconds."""
|
63
64
|
self.start_time_unix_nano = time.time_ns()
|
64
65
|
self.upsert_span()
|
66
|
+
# Register the end method to be called at exit
|
67
|
+
atexit.register(self.end)
|
65
68
|
|
66
69
|
def end(self):
|
67
70
|
"""End the span by recording the end time in nanoseconds."""
|
@@ -69,6 +72,8 @@ class Span:
|
|
69
72
|
raise ValueError("Span must be started before ending.")
|
70
73
|
self.end_time_unix_nano = time.time_ns()
|
71
74
|
self.upsert_span()
|
75
|
+
# Unregister the end method
|
76
|
+
atexit.unregister(self.end)
|
72
77
|
|
73
78
|
def _add_node(self, trace_id: UUID4, parent_id: Optional[bytes] = None):
|
74
79
|
"""Add node for obs tree."""
|
divi/signals/trace.py
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
import atexit
|
1
2
|
from datetime import UTC, datetime
|
2
3
|
from typing import Optional
|
3
4
|
from uuid import uuid4
|
@@ -63,6 +64,8 @@ class Trace:
|
|
63
64
|
"""Start the trace by recording the current time in nanoseconds."""
|
64
65
|
self.start_time = datetime.now(UTC).isoformat()
|
65
66
|
self.upsert_trace()
|
67
|
+
# Register the end method to be called on exit
|
68
|
+
atexit.register(self.end)
|
66
69
|
|
67
70
|
def end(self):
|
68
71
|
"""End the trace by recording the end time in nanoseconds."""
|
@@ -70,6 +73,8 @@ class Trace:
|
|
70
73
|
raise ValueError("Span must be started before ending.")
|
71
74
|
self.end_time = datetime.now(UTC).isoformat()
|
72
75
|
self.upsert_trace()
|
76
|
+
# Unregister the end method to prevent multiple calls
|
77
|
+
atexit.unregister(self.end)
|
73
78
|
|
74
79
|
def upsert_trace(self):
|
75
80
|
"""Upsert trace with datapark."""
|
@@ -1,5 +1,5 @@
|
|
1
1
|
divi/README.md,sha256=hdw10Mkebd1SGMeA3tPJtlOwbWZzuQ8J-N9YPEHGuXg,67
|
2
|
-
divi/__init__.py,sha256=
|
2
|
+
divi/__init__.py,sha256=FNz-nbMRHLhT-JWowhQTK7zMajy2XY0TFPD3Jjar1sw,436
|
3
3
|
divi/utils.py,sha256=fXkjoyo_Lh8AZliKICOP460m0czUcNQjcEcceJbaOVA,1439
|
4
4
|
divi/decorators/__init__.py,sha256=HkyWdC1ctTsVFucCWCkj57JB4NmwONus1d2S2dUbvs4,110
|
5
5
|
divi/decorators/collect.py,sha256=5iUxAnbHYx4ISkFg64IK_4miGdrWgbOXLJxKz8lGIv8,1074
|
@@ -44,9 +44,9 @@ divi/session/session.py,sha256=QxtEezI447PbtKG2U6cxL1ACae55e8nFfTufAY8pEYI,811
|
|
44
44
|
divi/session/setup.py,sha256=rC1QdCxpdCOaRXmcLEQs4Yuu5UC_aRzKSaqWRPJN4Og,1390
|
45
45
|
divi/session/teardown.py,sha256=YiBz_3yCiljMFEofZ60VmRL5sb8WA5GT7EYF8nFznZ4,133
|
46
46
|
divi/signals/__init__.py,sha256=wfSkkCwkRsFP4aLj8aGHk_k6Y50P5yN44WWlO3XyW18,43
|
47
|
-
divi/signals/span.py,sha256=
|
48
|
-
divi/signals/trace.py,sha256=
|
49
|
-
divi-0.0.
|
50
|
-
divi-0.0.
|
51
|
-
divi-0.0.
|
52
|
-
divi-0.0.
|
47
|
+
divi/signals/span.py,sha256=AQ24C8EKzGceryybX0rBe9B0z43kKaULdR6eOeOCtno,2804
|
48
|
+
divi/signals/trace.py,sha256=US_M2CAYNGUhEa5pppRPJN8dfNA5owgHMFDK2AOrFXA,2345
|
49
|
+
divi-0.0.1b2.dist-info/METADATA,sha256=IS0W_tN3EECkWRlX18GiUtX2idT3lYS2sAF2Z4jmoKA,493
|
50
|
+
divi-0.0.1b2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
51
|
+
divi-0.0.1b2.dist-info/licenses/LICENSE,sha256=5OJuZ4wMMEV0DgF0tofhAlS_KLkaUsZwwwDS2U_GwQ0,1063
|
52
|
+
divi-0.0.1b2.dist-info/RECORD,,
|
File without changes
|
File without changes
|