Skip to content

Commit 65eaf38

Browse files
committed
Revert "Add new_trace api to force a new trace"
This reverts commit 6d907a4.
1 parent 6d907a4 commit 65eaf38

File tree

4 files changed

+0
-41
lines changed

4 files changed

+0
-41
lines changed

sentry_sdk/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
"capture_exception",
2323
"capture_message",
2424
"continue_trace",
25-
"new_trace",
2625
"flush",
2726
"get_baggage",
2827
"get_client",

sentry_sdk/api.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@
4848
"capture_exception",
4949
"capture_message",
5050
"continue_trace",
51-
"new_trace",
5251
"flush",
5352
"get_baggage",
5453
"get_client",
@@ -316,15 +315,6 @@ def continue_trace(environ_or_headers: dict[str, Any]) -> Generator[None, None,
316315
yield
317316

318317

319-
@contextmanager
320-
def new_trace() -> Generator[None, None, None]:
321-
"""
322-
Force creation of a new trace.
323-
"""
324-
with get_isolation_scope().new_trace():
325-
yield
326-
327-
328318
@scopemethod
329319
def start_session(
330320
session_mode: str = "application",

sentry_sdk/opentelemetry/scope.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
TraceFlags,
1616
TraceState,
1717
use_span,
18-
INVALID_SPAN,
1918
)
2019

2120
from sentry_sdk.opentelemetry.consts import (
@@ -90,15 +89,6 @@ def continue_trace(
9089
with use_span(NonRecordingSpan(span_context)):
9190
yield
9291

93-
@contextmanager
94-
def new_trace(self) -> Generator[None, None, None]:
95-
"""
96-
Force creation of a new trace.
97-
"""
98-
self.generate_propagation_context()
99-
with use_span(INVALID_SPAN):
100-
yield
101-
10292
def _incoming_otel_span_context(self) -> Optional[SpanContext]:
10393
if self._propagation_context is None:
10494
return None

tests/test_api.py

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
from sentry_sdk import (
66
capture_exception,
77
continue_trace,
8-
new_trace,
98
get_baggage,
109
get_client,
1110
get_current_span,
@@ -97,25 +96,6 @@ def test_continue_trace(sentry_init):
9796
}
9897

9998

100-
def test_new_trace(sentry_init, capture_events):
101-
sentry_init(traces_sample_rate=1.0)
102-
events = capture_events()
103-
104-
with start_span(name="parent"):
105-
with start_span(name="child"):
106-
with new_trace():
107-
with start_span(name="parent2"):
108-
with start_span(name="child2"):
109-
pass
110-
111-
assert len(events) == 2
112-
(tx1, tx2) = events
113-
assert tx1["transaction"] == "parent2"
114-
assert tx1["spans"][0]["description"] == "child2"
115-
assert tx2["transaction"] == "parent"
116-
assert tx2["spans"][0]["description"] == "child"
117-
118-
11999
def test_is_initialized():
120100
assert not is_initialized()
121101

0 commit comments

Comments
 (0)