Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion ddtrace/_trace/span.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,12 @@ def finished(self, value: bool) -> None:
If the span is already finished and a truthy value is provided
no action will occur.
"""
deprecate(
prefix="The finished setter is deprecated",
message="""Use the finish() method to finish a span.""",
category=DDTraceDeprecationWarning,
removal_version="4.0.0",
)
if value:
if not self.finished:
self.duration_ns = Time.time_ns() - self.start_ns
Expand Down Expand Up @@ -820,7 +826,7 @@ def _set_link_or_append_pointer(self, link: Union[SpanLink, _SpanPointer]) -> No
except ValueError:
self._links.append(link)

def finish_with_ancestors(self) -> None:
def _finish_with_ancestors(self) -> None:
"""Finish this span along with all (accessible) ancestors of this span.

This method is useful if a sudden program shutdown is required and finishing
Expand All @@ -831,6 +837,15 @@ def finish_with_ancestors(self) -> None:
span.finish()
span = span._parent

@removals.remove(removal_version="4.0.0")
def finish_with_ancestors(self) -> None:
"""Finish this span along with all (accessible) ancestors of this span.

This method is useful if a sudden program shutdown is required and finishing
the trace is desired.
"""
self._finish_with_ancestors()

def __enter__(self) -> "Span":
return self

Expand Down
2 changes: 1 addition & 1 deletion ddtrace/contrib/internal/aws_lambda/patch.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def _crash_flush(self, _, __):

current_span = tracer.current_span()
if current_span is not None:
current_span.finish_with_ancestors()
current_span._finish_with_ancestors()

def _remove_alarm_signal(self):
"""Removes the handler set for the signal `SIGALRM`."""
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
deprecations:
- |
tracing: ``Span.finished`` setter is deprecated, use ``Span.finish()`` method instead.
- |
tracing: ``Span.finished_with_ancestors()`` is deprecated with no alternative.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
tracing: ``Span.finished_with_ancestors()`` is deprecated with no alternative.
tracing: ``Span.finish_with_ancestors()`` is deprecated with no alternative.

Loading