Skip to content

Interface: Span

Prefactor TypeScript SDK


Prefactor TypeScript SDK / @prefactor/core / Span

Defined in: packages/core/src/tracing/span.ts:56

A span represents a single operation in a trace

spanId: string

Defined in: packages/core/src/tracing/span.ts:58

Unique identifier for this span


parentSpanId: string | null

Defined in: packages/core/src/tracing/span.ts:61

ID of the parent span, or null if this is a root span


traceId: string

Defined in: packages/core/src/tracing/span.ts:64

Trace ID shared by all spans in a single trace


name: string

Defined in: packages/core/src/tracing/span.ts:67

Human-readable name for this span


spanType: string

Defined in: packages/core/src/tracing/span.ts:70

Type of operation this span represents


startTime: number

Defined in: packages/core/src/tracing/span.ts:73

Start time in milliseconds since Unix epoch


endTime: number | null

Defined in: packages/core/src/tracing/span.ts:76

End time in milliseconds since Unix epoch, or null if still running


status: SpanStatus

Defined in: packages/core/src/tracing/span.ts:79

Current status of the span


inputs: Record<string, unknown>

Defined in: packages/core/src/tracing/span.ts:82

Input data for this operation


outputs: Record<string, unknown> | null

Defined in: packages/core/src/tracing/span.ts:85

Output data from this operation, or null if not completed


tokenUsage: TokenUsage | null

Defined in: packages/core/src/tracing/span.ts:88

Token usage for LLM calls, or null if not applicable


error: ErrorInfo | null

Defined in: packages/core/src/tracing/span.ts:91

Error information if the span failed, or null if successful


metadata: Record<string, unknown>

Defined in: packages/core/src/tracing/span.ts:94

Additional metadata about this span