Skip to content

Commit a710eb3

Browse files
fix(cohere): Stop setting transaction status when child span fails
1 parent 3d9c131 commit a710eb3

2 files changed

Lines changed: 1 addition & 5 deletions

File tree

sentry_sdk/integrations/cohere.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
from sentry_sdk.ai.monitoring import record_token_usage
77
from sentry_sdk.ai.utils import get_start_span_function, set_data_normalized
88
from sentry_sdk.consts import SPANDATA
9-
from sentry_sdk.tracing_utils import set_span_errored
109

1110
if TYPE_CHECKING:
1211
from typing import Any, Callable, Iterator
@@ -83,8 +82,6 @@ def setup_once() -> None:
8382

8483

8584
def _capture_exception(exc: "Any") -> None:
86-
set_span_errored()
87-
8885
event, hint = event_from_exception(
8986
exc,
9087
client_options=sentry_sdk.get_client().options,
@@ -154,7 +151,7 @@ def new_chat(*args: "Any", **kwargs: "Any") -> "Any":
154151
exc_info = sys.exc_info()
155152
with capture_internal_exceptions():
156153
_capture_exception(e)
157-
span.__exit__(None, None, None)
154+
span.__exit__(*exc_info)
158155
reraise(*exc_info)
159156

160157
with capture_internal_exceptions():

tests/integrations/cohere/test_cohere.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,6 @@ def test_span_status_error(sentry_init, capture_events):
183183
assert error["level"] == "error"
184184
assert transaction["spans"][0]["status"] == "internal_error"
185185
assert transaction["spans"][0]["tags"]["status"] == "internal_error"
186-
assert transaction["contexts"]["trace"]["status"] == "internal_error"
187186

188187

189188
@pytest.mark.parametrize(

0 commit comments

Comments
 (0)