Skip to content

Commit 92c27b4

Browse files
committed
add a span processor test
1 parent 4e1fa6f commit 92c27b4

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import sentry_sdk
2+
3+
4+
def test_span_processor_omits_underscore_attributes(sentry_init, capture_events):
5+
sentry_init(traces_sample_rate=1.0)
6+
7+
events = capture_events()
8+
9+
with sentry_sdk.start_span():
10+
with sentry_sdk.start_span() as span:
11+
span.set_attribute("_internal", 47)
12+
span.set_attribute("noninternal", 23)
13+
14+
assert span._otel_span.attributes["_internal"] == 47
15+
assert span._otel_span.attributes["noninternal"] == 23
16+
17+
outgoing_span = events[0]["spans"][0]
18+
assert "_internal" not in outgoing_span["data"]
19+
assert "noninternal" in outgoing_span["data"]

0 commit comments

Comments
 (0)