Skip to content

Graphorin API reference v0.7.0


Graphorin API reference / @graphorin/store-sqlite / / pruneSpans

Function: pruneSpans()

ts
function pruneSpans(conn, opts): number;

Defined in: packages/store-sqlite/src/span-store.ts:137

Age-based span retention (W-008): delete every span that FINISHED before the cutoff, including rows with session_id IS NULL (not attached to any session, so age is their only deletion path). The cutoff is epoch milliseconds - the ns conversion happens here so callers never juggle units; sub-ms precision loss at the 2^53 boundary is irrelevant for retention. Backed by the idx_spans_end index (migration 030), so the sweep is not a full table scan. Returns the number of rows deleted.

Parameters

ParameterType
connSqliteConnection
opts{ beforeEpochMs: number; }
opts.beforeEpochMsnumber

Returns

number

Stable