Skip to content

Commit 065d55b

Browse files
authored
ref: Add active to StreamedSpan (#5590)
### Description `active` is also part of the public API (`start_span(name="...", active=False)`), so it'll need to propagate to the `StreamedSpan` class. #### Issues <!-- * resolves: #1234 * resolves: LIN-1234 --> #### Reminders - Please add tests to validate your changes, and lint your code using `tox -e linters`. - Add GH Issue ID _&_ Linear ID (if applicable) - PR title should use [conventional commit](https://develop.sentry.dev/engineering-practices/commit-messages/#type) style (`feat:`, `fix:`, `ref:`, `meta:`) - For external contributors: [CONTRIBUTING.md](https://github.com/getsentry/sentry-python/blob/master/CONTRIBUTING.md), [Sentry SDK development docs](https://develop.sentry.dev/sdk/), [Discord community](https://discord.gg/Ww9hbqr)
1 parent 1a11da9 commit 065d55b

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

sentry_sdk/traces.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ class StreamedSpan:
7070
__slots__ = (
7171
"_name",
7272
"_attributes",
73+
"_active",
7374
"_span_id",
7475
"_trace_id",
7576
"_status",
@@ -80,9 +81,11 @@ def __init__(
8081
*,
8182
name: str,
8283
attributes: "Optional[Attributes]" = None,
84+
active: bool = True,
8385
trace_id: "Optional[str]" = None,
8486
):
8587
self._name: str = name
88+
self._active: bool = active
8689
self._attributes: "Attributes" = {}
8790
if attributes:
8891
for attribute, value in attributes.items():
@@ -99,7 +102,8 @@ def __repr__(self) -> str:
99102
f"<{self.__class__.__name__}("
100103
f"name={self._name}, "
101104
f"trace_id={self.trace_id}, "
102-
f"span_id={self.span_id})>"
105+
f"span_id={self.span_id}, "
106+
f"active={self._active})>"
103107
)
104108

105109
def get_attributes(self) -> "Attributes":
@@ -143,6 +147,10 @@ def name(self) -> str:
143147
def name(self, name: str) -> None:
144148
self._name = name
145149

150+
@property
151+
def active(self) -> bool:
152+
return self._active
153+
146154
@property
147155
def span_id(self) -> str:
148156
if not self._span_id:

0 commit comments

Comments
 (0)