From f4291e8408fae87fad02e79bdf0c79497c9d1eb7 Mon Sep 17 00:00:00 2001 From: Michael Kouremetis Date: Mon, 1 Dec 2025 09:56:15 -0500 Subject: [PATCH 1/2] fix --- dreadnode/tracing/span.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/dreadnode/tracing/span.py b/dreadnode/tracing/span.py index 3d6ae85..edc0656 100644 --- a/dreadnode/tracing/span.py +++ b/dreadnode/tracing/span.py @@ -219,14 +219,16 @@ def failed(self) -> bool: def exception(self) -> BaseException | None: """Get the exception recorded in the span, if any.""" return self._exception - + @property def duration(self) -> float: """Get the duration of the span in seconds.""" if self._span is None: return 0.0 - end_time = self.end_time or time.time() - return (end_time - self.start_time) if self.start_time else 0.0 + end_time = self.end_time or time.time_ns() + if not self.start_time: + return 0.0 + return (end_time - self.start_time) / 1e9 def set_tags(self, tags: t.Sequence[str]) -> None: tags = [tags] if isinstance(tags, str) else list(tags) From cd6e7774f8f5dd8729b1061ef150af57ab2f1daa Mon Sep 17 00:00:00 2001 From: Michael Kouremetis Date: Mon, 1 Dec 2025 09:57:51 -0500 Subject: [PATCH 2/2] fix --- dreadnode/tracing/span.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dreadnode/tracing/span.py b/dreadnode/tracing/span.py index edc0656..05b1759 100644 --- a/dreadnode/tracing/span.py +++ b/dreadnode/tracing/span.py @@ -219,7 +219,7 @@ def failed(self) -> bool: def exception(self) -> BaseException | None: """Get the exception recorded in the span, if any.""" return self._exception - + @property def duration(self) -> float: """Get the duration of the span in seconds."""