Skip to main content

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

from adaline_api.models.trace_status import TraceStatus

Type Definition

TraceStatus is a str literal with the following allowed values:
ValueDescription
"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

from adaline.main import Adaline

adaline = Adaline()
monitor = await adaline.init_monitor(project_id="project_abc123")

trace = monitor.log_trace(
    name="Chat Completion",
    status="pending",
    tags=["production"],
)

Updating status after completion

trace.update({"status": "success"})

Conditional status based on outcome

try:
    result = await run_pipeline(trace)
    trace.update({"status": "success"})
except TimeoutError:
    trace.update({"status": "aborted"})
except Exception:
    trace.update({"status": "failure"})

  • Trace — the class that uses TraceStatus
  • SpanStatus — the equivalent status type for spans (excludes "pending")
  • Monitor — creates traces via log_trace()