Skip to content
Merged
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
4 changes: 4 additions & 0 deletions CHANGLOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## [0.1.22] - 2026-01-06
### Added
- support span discard

## [0.1.21] - 2025-12-23
### Added
- runtime scene support get from env
Expand Down
3 changes: 3 additions & 0 deletions cozeloop/internal/trace/noop_span.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ def set_tags(self, tag_kvs: Dict[str, Any]) -> None:
def set_baggage(self, baggage_items: Dict[str, str]) -> None:
pass

def discard(self) -> None:
pass

def finish(self) -> None:
pass

Expand Down
3 changes: 3 additions & 0 deletions cozeloop/internal/trace/span.py
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,9 @@ def set_baggage_item(self, restricted_key: str, value: str):
with self.lock:
super().set_baggage_item(restricted_key, value)

def discard(self) -> None:
delete_span_in_context(self.span_id)

def finish(self):
try:
if not self.is_do_finish():
Expand Down
6 changes: 6 additions & 0 deletions cozeloop/span.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,12 @@ def finish(self) -> None:
Under the hood, it is actually placed in an asynchronous queue waiting to be reported.
"""

@abstractmethod
def discard(self) -> None:
"""
The span will be discarded, not be reported.
"""

@property
@abstractmethod
def start_time(self) -> datetime:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "cozeloop"
version = "0.1.21"
version = "0.1.22"
description = "coze loop sdk"
authors = ["JiangQi715 <[email protected]>"]
license = "MIT"
Expand Down