
- It highlights the success or failure of individual spans within a trace.
- It enables error detection and filtering in observability platforms (for example: show all spans with
status = ERRORbetween 09:00–10:00). - It supports root-cause diagnostics across distributed systems by indicating which service, application, or environment is experiencing problems.

UNSET(default)ERROROK

| Status | When to use | Notes |
|---|---|---|
UNSET | Default for most spans; nothing noteworthy from an error perspective | Implies implicit success — common and usually preferred |
ERROR | When an exception, timeout, or HTTP 4xx/5xx is observed | Instrumentation or application code can set this to surface failures |
OK | When you explicitly want to mark a span as successful | Useful to override the default when handled errors should not be considered failures |
status to ERROR. A typical span payload with an exception event and an ERROR status looks like:
The attributes
exception.type, exception.message, and exception.stacktrace follow the OpenTelemetry semantic conventions for exceptions. These attributes let observability tools display error details and group similar errors. See the OpenTelemetry spec for exceptions for more details: https://opentelemetry.io/docs/reference/specification/semantic_conventions/exceptions/status to ERROR and includes a summary description. This makes it straightforward to filter traces for failures and inspect the associated exception attributes.
When to use OK versus leaving status UNSET
- Keep
UNSETwhen nothing noteworthy has occurred (the implicit success path). This is the common default. - Use
OKwhen you intentionally want to mark a span as successful despite non-standard conditions. Examples:- Your application handles certain errors internally (e.g., a cache miss producing an HTTP 404 that is expected) and you do not want these spans to appear as failures.
- A span represents a step in a multi-step or asynchronous process where success is only known later; set
OKexplicitly when the overall operation completes successfully.

- Span events (especially exception events) carry attributes such as
exception.type,exception.message, andexception.stacktrace. - Span status offers an at-a-glance indication of success (
OK), failure (ERROR), or implicit/unspecified success (UNSET). - Most spans remain
UNSET. UseERRORfor detected failures and setOKexplicitly only when you need to override default behavior.

- OpenTelemetry Tracing: https://opentelemetry.io/docs/
- OpenTelemetry Semantic Conventions — Exceptions: https://opentelemetry.io/docs/reference/specification/semantic_conventions/exceptions/