Two-step aggregation
This group of functions uses the two-step aggregation pattern. Rather than calculating the final result in one step, you first create an intermediate aggregate by using the aggregate function. Then, use any of the accessors on the intermediate aggregate to calculate a final result. You can also roll up multiple intermediate aggregates with the rollup functions. The two-step aggregation pattern has several advantages:- More efficient because multiple accessors can reuse the same aggregate
- Easier to reason about performance, because aggregation is separate from final computation
- Easier to understand when calculations can be rolled up into larger intervals, especially in window functions and continuous aggregates
- Can perform retrospective analysis even when underlying data is dropped, because the intermediate aggregate stores extra information not available in the final result
Functions in this group
Aggregate
heartbeat_agg(): aggregate heartbeat data into an intermediate form for further computation
Accessors
uptime(): get the total uptime from the aggregatedowntime(): get the total downtime from the aggregateinterpolated_uptime(): get the total uptime, interpolating values at the boundaryinterpolated_downtime(): get the total downtime, interpolating values at the boundarylive_at(): determine if the system was live at a given timelive_ranges(): get all time ranges when the system was livedead_ranges(): get all time ranges when the system was deadnum_live_ranges(): count the number of live rangesnum_gaps(): count the number of gaps (downtime periods)trim_to(): trim the aggregate to a specific time range
Mutator
interpolate(): interpolate the state at interval boundaries
Rollup
rollup(): combine multiple intermediate aggregates