Skip to content

Commit eae56d4

Browse files
committed
ref: Add no-op streaming span class
1 parent a655dca commit eae56d4

1 file changed

Lines changed: 53 additions & 0 deletions

File tree

sentry_sdk/traces.py

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,3 +165,56 @@ def trace_id(self) -> str:
165165
self._trace_id = uuid.uuid4().hex
166166

167167
return self._trace_id
168+
169+
170+
class NoOpStreamedSpan(StreamedSpan):
171+
__slots__ = (
172+
)
173+
174+
def __init__(
175+
self,
176+
) -> None:
177+
pass
178+
179+
def __repr__(self) -> str:
180+
return f"<{self.__class__.__name__}(sampled={self.sampled})>"
181+
182+
def get_attributes(self) -> "Attributes":
183+
return {}
184+
185+
def set_attribute(self, key: str, value: "AttributeValue") -> None:
186+
pass
187+
188+
def set_attributes(self, attributes: "Attributes") -> None:
189+
pass
190+
191+
def remove_attribute(self, key: str) -> None:
192+
pass
193+
194+
@property
195+
def status(self) -> "str":
196+
return SpanStatus.OK.value
197+
198+
@status.setter
199+
def status(self, status: "Union[SpanStatus, str]") -> None:
200+
pass
201+
202+
@property
203+
def name(self) -> str:
204+
return ""
205+
206+
@name.setter
207+
def name(self, value: str) -> None:
208+
pass
209+
210+
@property
211+
def active(self) -> bool:
212+
return True
213+
214+
@property
215+
def span_id(self) -> str:
216+
return "0000000000000000"
217+
218+
@property
219+
def trace_id(self) -> str:
220+
return "00000000000000000000000000000000"

0 commit comments

Comments
 (0)