Skip to content

Commit

Permalink
Updated some tests to expect the span status NOT to be in the tags.
Browse files Browse the repository at this point in the history
  • Loading branch information
antonpirker committed Feb 25, 2025
1 parent d2011b3 commit 9e18a82
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
3 changes: 0 additions & 3 deletions sentry_sdk/integrations/opentelemetry/span_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,9 +261,6 @@ def _span_to_json(self, span):
}
)

if status:
span_json.setdefault("tags", {})["status"] = status

if parent_span_id:
span_json["parent_span_id"] = parent_span_id

Expand Down
11 changes: 5 additions & 6 deletions tests/tracing/test_integration_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,10 @@ def test_basic(sentry_init, capture_events, sample_rate):

span1, span2 = event["spans"]
parent_span = event
assert span1["tags"]["status"] == "internal_error"
assert span1["status"] == "internal_error"
assert span1["op"] == "foo"
assert span1["description"] == "foodesc"
assert span2["tags"]["status"] == "ok"
assert span2["status"] == "ok"
assert span2["op"] == "bar"
assert span2["description"] == "bardesc"
assert parent_span["transaction"] == "hi"
Expand Down Expand Up @@ -253,8 +252,8 @@ def test_non_error_exceptions(
sentry_init(traces_sample_rate=1.0)
events = capture_events()

with start_span(name="hi") as span:
span.set_status(SPANSTATUS.OK)
with start_span(name="hi") as root_span:
root_span.set_status(SPANSTATUS.OK)
with pytest.raises(exception_cls):
with start_span(op="foo", name="foodesc"):
raise exception_cls(exception_value)
Expand All @@ -264,7 +263,7 @@ def test_non_error_exceptions(

span = event["spans"][0]
assert "status" not in span.get("tags", {})
assert "status" not in event["tags"]
assert "status" not in event.get("tags", {})
assert event["contexts"]["trace"]["status"] == "ok"


Expand All @@ -289,5 +288,5 @@ def test_good_sysexit_doesnt_fail_transaction(

span = event["spans"][0]
assert "status" not in span.get("tags", {})
assert "status" not in event["tags"]
assert "status" not in event.get("tags", {})
assert event["contexts"]["trace"]["status"] == "ok"

0 comments on commit 9e18a82

Please sign in to comment.