Skip to main content

SpanStatus

Allowed status values for a Span.

Import

import type { SpanStatus } from '@adaline/client';

Definition

type SpanStatus = 'success' | 'failure' | 'aborted' | 'cancelled' | 'unknown';

Values

ValueDescription
'success'The span completed successfully with the expected result.
'failure'The span encountered an error and did not produce a valid result.
'aborted'The span was terminated before completion due to an external signal (e.g., timeout).
'cancelled'The span was intentionally stopped by the caller before it finished.
'unknown'The status was not explicitly set. This is the default when no status is provided.
SpanStatus does not include 'pending'. The 'pending' value is only available on TraceStatus, since a trace can represent an in-progress operation, while individual spans are expected to resolve before being flushed.

Usage

import { Adaline } from '@adaline/client';

const adaline = new Adaline();
const monitor = adaline.initMonitor({ projectId: 'my-project' });

const trace = monitor.logTrace({ name: 'Chat Request' });
const span = trace.logSpan({ name: 'LLM Call' });

try {
  const result = await callLLM();

  span.update({ status: 'success' });
  trace.update({ status: 'success' });
} catch (error) {
  span.update({ status: 'failure' });
  trace.update({ status: 'failure' });
} finally {
  span.end();
  trace.end();
}

See Also

  • Span — the class that uses SpanStatus
  • Trace — uses TraceStatus, which adds 'pending'