TraceStatus
Allowed status values for a Trace.Overview
TraceStatus defines the lifecycle states a trace can be in. Every trace has a status that indicates whether it completed, failed, or is still in progress. The default status is "unknown".
Import
Type Definition
TraceStatus is a str literal with the following allowed values:
| Value | Description |
|---|---|
"success" | The trace completed successfully with the expected outcome. |
"failure" | The trace encountered an error and did not complete. |
"aborted" | The trace was terminated before completion due to an external signal (e.g., timeout). |
"cancelled" | The trace was explicitly cancelled by the user or application logic. |
"pending" | The trace is still in progress and has not yet resolved. |
"unknown" | Status has not been set. This is the default. |
Unlike SpanStatus,
TraceStatus includes the "pending" value because traces can represent long-running operations whose outcome is not yet known.Usage
Setting status on a new trace
Updating status after completion
Conditional status based on outcome
Related
- Trace — the class that uses
TraceStatus - SpanStatus — the equivalent status type for spans (excludes
"pending") - Monitor — creates traces via
log_trace()