SpanStatus
Allowed status values for a Span.Overview
SpanStatus defines the lifecycle states a span can be in. Every span has a status that indicates whether the operation completed, failed, or was interrupted. The default status is "unknown".
Import
Type Definition
SpanStatus is a str literal with the following allowed values:
| Value | Description |
|---|---|
"success" | The span completed successfully with the expected outcome. |
"failure" | The span encountered an error and did not complete. |
"aborted" | The span was terminated before completion due to an external signal (e.g., timeout). |
"cancelled" | The span was explicitly cancelled by the user or application logic. |
"unknown" | Status has not been set. This is the default. |
Usage
Setting status on a new span
Updating status after an LLM call
Comparison with TraceStatus
| Value | SpanStatus | TraceStatus |
|---|---|---|
"success" | Yes | Yes |
"failure" | Yes | Yes |
"aborted" | Yes | Yes |
"cancelled" | Yes | Yes |
"pending" | No | Yes |
"unknown" | Yes | Yes |
Related
- Span — the class that uses
SpanStatus - TraceStatus — the equivalent status type for traces (includes
"pending") - Trace — parent container for spans