live_at()
Test if the aggregate has a heartbeat covering a given time
Since 1.15.0
Determine whether the aggregate has a heartbeat indicating the system was live at a given time.
Note that this returns false for any time not covered by the aggregate.
Samples
Section titled “Samples”Given a table called liveness containing weekly heartbeat aggregates in column health with timestamp column date,
use the following to see if the system was live at a particular time.
SELECT live_at(health, '2022-01-12 15:30:00+00')FROM livenessWHERE date = '01-9-2022 UTC'Returns:
live_at--------- fArguments
Section titled “Arguments”The syntax is:
live_at( agg HEARTBEATAGG, test TIMESTAMPTZ) RETURNS BOOL| Name | Type | Default | Required | Description |
|---|---|---|---|---|
| agg | HeartbeatAgg | - | ✔ | A heartbeat aggregate to get the liveness data from |
| test | TimestampTz | - | ✔ | The time to test the liveness of |
Returns
Section titled “Returns”| Column | Type | Description |
|---|---|---|
| live_at | bool | True if the heartbeat aggregate had a heartbeat close before the test time. |