Skip to content

Commit 46f4691

Browse files
committed
propagation context test
1 parent 92c8d41 commit 46f4691

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

tests/test_metrics.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ def test_metrics_with_span(sentry_init, capture_envelopes):
137137
sentry_init(_experiments={"enable_metrics": True}, traces_sample_rate=1.0)
138138
envelopes = capture_envelopes()
139139

140-
with sentry_sdk.start_span(op="test", name="test-span"):
140+
with sentry_sdk.start_transaction(op="test", name="test-span"):
141141
_metrics.count("test.span.counter", 1)
142142

143143
get_client().flush()
@@ -150,6 +150,22 @@ def test_metrics_with_span(sentry_init, capture_envelopes):
150150
assert metrics[0]["span_id"] is not None
151151

152152

153+
def test_metrics_tracing_without_performance(sentry_init, capture_envelopes):
154+
sentry_init(_experiments={"enable_metrics": True})
155+
envelopes = capture_envelopes()
156+
157+
_metrics.count("test.span.counter", 1)
158+
159+
get_client().flush()
160+
161+
metrics = envelopes_to_metrics(envelopes)
162+
assert len(metrics) == 1
163+
164+
assert metrics[0]["trace_id"] is not None
165+
assert metrics[0]["trace_id"] != "00000000-0000-0000-0000-000000000000"
166+
assert metrics[0]["span_id"] is not None
167+
168+
153169
def test_metrics_before_send(sentry_init, capture_envelopes):
154170
before_metric_called = False
155171

0 commit comments

Comments
 (0)