> ## Documentation Index
> Fetch the complete documentation index at: https://www.adaline.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# SpanStatus

# SpanStatus

Allowed status values for a [Span](/docs/reference/sdk/v2/python/classes/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

```python theme={null}
from adaline_api.models.span_status import SpanStatus
```

## 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.                                        |

<Warning>
  `SpanStatus` does **not** include `"pending"`. Unlike [TraceStatus](/docs/reference/sdk/v2/python/types/TraceStatus), spans represent discrete operations that are either complete or not — use `"unknown"` until the span resolves.
</Warning>

***

## Usage

### Setting status on a new span

```python theme={null}
span = trace.log_span(
    name="LLM Call",
    status="unknown",
    tags=["openai"],
)
```

### Updating status after an LLM call

```python theme={null}
import json
from adaline_api.models.log_span_content import LogSpanContent
from adaline_api.models.log_span_model_content import LogSpanModelContent

try:
    response = openai.chat.completions.create(**params)
    span.update({
        "status": "success",
        "content": LogSpanContent(
            actual_instance=LogSpanModelContent(
                type="Model",
                provider="openai",
                model="gpt-4o",
                input=json.dumps(params),
                output=json.dumps(response.model_dump()),
            )
        ),
    })
except Exception:
    span.update({"status": "failure"})
```

***

## 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](/docs/reference/sdk/v2/python/classes/span) — the class that uses `SpanStatus`
* [TraceStatus](/docs/reference/sdk/v2/python/types/TraceStatus) — the equivalent status type for traces (includes `"pending"`)
* [Trace](/docs/reference/sdk/v2/python/classes/trace) — parent container for spans
