pub fn record_error(span: &Span, err: &Error, config: &ObservabilityConfig)Expand description
Record an error onto a span following the existing error.type pattern:
error.type (the framework Error variant tag), plus the
tracing-opentelemetry “special fields” otel.status_code ("ERROR")
and — only with content capture on — otel.status_message (the error’s
Display text), so that a bridge sets real OTel span status. This
mirrors Python’s capture_exception (record_exception + set_status,
observability.py:1407-1411) as far as bare tracing fields allow —
there is no span-events API here without also taking on an SDK
dependency.
The message is treated as sensitive, like message content and tool
arguments (upstream #9288). An error’s Display text is not metadata: a
provider’s 400 quotes the request back, a tool’s failure prints the
argument it choked on, a transport error carries the URL — query string,
SAS token and all. Spans leave the process, so an error string sent
unconditionally publishes to the telemetry backend exactly the content
enable_sensitive_data exists to withhold. error.type and the ERROR
status always go, so a redacted span still says that the call failed
and in which variant; only the free-form text waits for the opt-in.