Skip to content

Commit 019fa47

Browse files
committed
fix typing issue
1 parent b47362d commit 019fa47

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

sentry_sdk/tracing_utils.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ def _should_be_included(
231231

232232

233233
def add_source(
234-
span: Union["sentry_sdk.tracing.Span", "sentry_sdk.traces.StreamedSpan"],
234+
span: "Union[sentry_sdk.tracing.Span, sentry_sdk.traces.StreamedSpan]",
235235
project_root: "Optional[str]",
236236
in_app_include: "Optional[list[str]]",
237237
in_app_exclude: "Optional[list[str]]",
@@ -367,10 +367,10 @@ def add_http_request_source_for_streamed_span(
367367
if not should_add_request_source:
368368
return
369369

370-
try:
370+
if span.start_timestamp_monotonic_ns is not None:
371371
elapsed = nanosecond_time() - span.start_timestamp_monotonic_ns
372372
end_timestamp = span.start_timestamp + timedelta(microseconds=elapsed / 1000)
373-
except (AttributeError, TypeError):
373+
else:
374374
end_timestamp = datetime.now(timezone.utc)
375375

376376
duration = end_timestamp - span.start_timestamp

0 commit comments

Comments
 (0)