Skip to main content

select_instants

Function select_instants 

Source
pub fn select_instants(
    time: &RawTimestamps,
    fields: &SeriesFields,
    range: RangeInclusive<i64>,
    step_ms: i64,
    lookback_ms: i64,
    offset_ms: i64,
) -> Result<(Vec<u64>, Vec<i64>)>
Expand description

Selects source rows for an aligned PromQL instant-evaluation range.

Returns original logical row indices and evaluation timestamps from a complete source axis of strictly increasing milliseconds. Any provided field’s stale marker suppresses selection; missing samples are not stale and remain selectable.

The ordering of the axis is [RawTimestamps]’ own guarantee, checked when it was built, so this walks the axis once – one cursor advance per row – and validates nothing about it again.

The two vectors it returns hold one u64 source row index and one i64 evaluation timestamp per selected point, so what it allocates is 16 bytes per point of the clipped grid rather than anything proportional to the samples of the axis. It reserves none of that: every caller grows a memory reservation for those two vectors before it calls, which is what bounds an instant selection now that the kernel carries no point limit of its own.