Skip to main content
Since 1.16.0 Return the number of gaps between the periods of liveness. Additionally, if the aggregate is not live at the start or end of its covered interval, these are also considered gaps.
num_gaps(
    agg HEARTBEATAGG
) RETURNS BIGINT

Arguments

NameTypeDefaultRequiredDescription
aggHeartbeatAgg-A heartbeat aggregate to get the number of gaps from

Returns

ColumnTypeDescription
num_gapsbigintThe number of gaps in the aggregate

Samples

Given a table called liveness containing weekly heartbeat aggregates in column health with timestamp column date, use this query to see how many times the system was down in a particular week:
SELECT num_gaps(health)
FROM liveness
WHERE date = '01-9-2022 UTC'
Returns:
 num_gaps
---------
 4