Skip to content

Commit c0bda2b

Browse files
committed
cleanup
1 parent 3106f4b commit c0bda2b

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

sentry_sdk/tracing_utils.py

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -882,15 +882,6 @@ def sync_wrapper(*args, **kwargs):
882882
return span_decorator
883883

884884

885-
def set_span_errored(span=None):
886-
# type: (Optional[Span]) -> None
887-
span = span or get_current_span()
888-
if span is not None:
889-
span.set_status(SPANSTATUS.ERROR)
890-
if span.containing_transaction is not None:
891-
span.containing_transaction.set_status(SPANSTATUS.ERROR)
892-
893-
894885
def get_current_span(scope=None):
895886
# type: (Optional[sentry_sdk.Scope]) -> Optional[Span]
896887
"""
@@ -901,6 +892,19 @@ def get_current_span(scope=None):
901892
return current_span
902893

903894

895+
def set_span_errored(span=None):
896+
# type: (Optional[Span]) -> None
897+
"""
898+
Set the status of the current or given span to ERROR.
899+
Also sets the status of the transaction (root span) to ERROR.
900+
"""
901+
span = span or get_current_span()
902+
if span is not None:
903+
span.set_status(SPANSTATUS.ERROR)
904+
if span.containing_transaction is not None:
905+
span.containing_transaction.set_status(SPANSTATUS.ERROR)
906+
907+
904908
def _generate_sample_rand(
905909
trace_id, # type: Optional[str]
906910
*,

0 commit comments

Comments
 (0)