Heartbeat detection

Supported in: Streaming

Detects when a record hasn't been seen for a configurable amount of time for a set of keys.

Transform categories: Other

Declared arguments

  • Dataset: Input dataset.
    Table
  • Heartbeat time unit: Unit for amount of time to wait for data for a particular key.
    Enum<Days, Hours, Milliseconds, Minutes, Seconds, Weeks>
  • Heartbeat time value: Value for the amount of time to wait for data from a particular key.
    Literal<Long>
  • Partition by columns: Set of columns to use as keys for detecting heartbeats.
    Set<Column<AnyType>>

Examples

Example 1: Base case

Description: The first record from sensor_1 at time 00:00:00 triggers an alive heartbeat detection. The second record at 00:00:05 extends the timeout but does not emit a new detection. The third record from sensor_2 at 00:00:20 advances the watermark past 00:00:15, causing sensor_1's timeout timer to fire and marking its heartbeat as missed. The sensor_2 record also triggers its own alive detection.

Argument values:

  • Dataset: ri.foundry.main.dataset.test
  • Heartbeat time unit: SECONDS
  • Heartbeat time value: 10
  • Partition by columns: {sensor_id}

Input:

row_ordersensor_idtemperaturemeasurement_timestamp
3sensor_219.82024-09-30T00:00:20
2sensor_121.02024-09-30T00:00:05
1sensor_120.52024-09-30T00:00:00

Output:

sensor_idalivedetection_time
sensor_1true2024-09-30T00:00:00Z
sensor_1false2024-09-30T00:00:15Z
sensor_2true2024-09-30T00:00:20Z

Example 2: Base case

Description: Each partition key maintains independent state and timers, but all keys share the same global watermark. sensor_1 sends data at 00:00:00 and sensor_2 at 00:00:05. The record from sensor_3 at 00:00:20 advances the watermark past both timeout thresholds, causing sensor_1's timer at 00:00:10 and sensor_2's timer at 00:00:15 to fire in sequence, marking both as missed.

Argument values:

  • Dataset: ri.foundry.main.dataset.test
  • Heartbeat time unit: SECONDS
  • Heartbeat time value: 10
  • Partition by columns: {sensor_id}

Input:

row_ordersensor_idtemperaturemeasurement_timestamp
3sensor_322.12024-09-30T00:00:20
2sensor_218.32024-09-30T00:00:05
1sensor_120.52024-09-30T00:00:00

Output:

sensor_idalivedetection_time
sensor_1true2024-09-30T00:00:00Z
sensor_2true2024-09-30T00:00:05Z
sensor_1false2024-09-30T00:00:10Z
sensor_2false2024-09-30T00:00:15Z
sensor_3true2024-09-30T00:00:20Z