Skip to content

Commit adc9ccf

Browse files
committed
revert(core): keep cancellation out of span error status
The #536 change marked any BaseException that unwinds a manual span as ERROR and put the exception text in the status. That breaks guardrails' stream contract (a cancelled stream is not an error and its cancel message is not exported) and differs from OpenTelemetry, which deliberately leaves cancellation alone. Restore _tracers.py exactly as it was on a151e45 and drop its test and changelog line. #536's OpenAI part (truncated multi-choice streams export ERROR) is unchanged.
1 parent a67c16f commit adc9ccf

3 files changed

Lines changed: 1 addition & 164 deletions

File tree

‎python/CHANGELOG.md‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
identifier are no longer read as phone numbers, and card numbers must be card-shaped and pass the
66
Luhn check. Free text and metadata are still redacted when the flag is on; hide flags and the image
77
cap apply to every field.
8-
- Manual agent/span contexts now mark `BaseException` interruptions (including `KeyboardInterrupt`, `asyncio.CancelledError` and `GeneratorExit`) as ERROR when exception status recording is enabled, preserving exception propagation, cancellation and caller flags.
98

109
## [1.3.0] - pending release
1110
### Added

‎python/fi_instrumentation/instrumentation/_tracers.py‎

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -203,20 +203,7 @@ def start_as_current_span(
203203
record_exception=record_exception,
204204
set_status_on_exception=set_status_on_exception,
205205
) as current_span:
206-
try:
207-
yield cast(FiSpan, current_span)
208-
except BaseException as error:
209-
# OTel use_span handles Exception, but excludes cancellation and
210-
# other local aborts. Record those before the span ends, without
211-
# duplicating ordinary exceptions or bypassing FiSpan's privacy.
212-
if not isinstance(error, Exception) and span.is_recording():
213-
if record_exception:
214-
span.record_exception(error, escaped=True)
215-
if set_status_on_exception:
216-
span.set_status(Status(
217-
StatusCode.ERROR, f"{type(error).__name__}: {error}"
218-
))
219-
raise
206+
yield cast(FiSpan, current_span)
220207

221208
def start_span(
222209
self,

‎python/tests/test_tracer_cancellation.py‎

Lines changed: 0 additions & 149 deletions
This file was deleted.

0 commit comments

Comments
 (0)