A telemetry span representing a unit of work

interface AISpan {
    id: string;
    name: string;
    type: SpanType;
    startTime: Date;
    endTime?: Date;
    durationMs?: number;
    status: SpanStatus;
    error?: Error;
    attributes: Record<string, string | number | boolean>;
    setAttribute(key: string, value: string | number | boolean): void;
    setAttributes(attributes: Record<string, string | number | boolean>): void;
    recordException(error: Error): void;
    setStatus(status: SpanStatus, message?: string): void;
    end(): void;
}

Methods

  • Set an attribute on the span

    Parameters

    • key: string
    • value: string | number | boolean

    Returns void

  • Set multiple attributes

    Parameters

    • attributes: Record<string, string | number | boolean>

    Returns void

Properties

id: string

Unique identifier for this span

name: string

Span name

type: SpanType

Span type

startTime: Date

Start time

endTime?: Date

End time (set when span is completed)

durationMs?: number

Span duration in milliseconds

status: SpanStatus

Span status

error?: Error

Error if span failed

attributes: Record<string, string | number | boolean>

Span attributes (metadata)