Current delay
Description
The current_delay
sensor calculates the timestamp difference between last record
(the newest one appointed by MAX()
function) and a CURRENT_TIMESTAMP()
.
When to use
Current delay check is mostly used, when we deal with a dataset that is updated frequently.
Used sensor
Accepted rules
Although there are several options for the rule choice, the most logical one to use is max_count
...
Parameters
This checks has two parameters that configure date format to parse:
column
: str
name of the column to calculate timestamp difference withCURRENT_TIMESTAMP()
time_scale
: str (Optional)
time scale to measure timestamp difference,the default value is DAY, acceptable values: MONTH, WEEK, DAY, HOUR, MINUTE, SECOND (default DAY)
How to use
SELECT
TIMESTAMP_DIFF(CURRENT_TIMESTAMP(),
MAX(analyzed_table.timestamp_column),
DAY) AS actual_value, CAST(CURRENT_TIMESTAMP() AS date) AS time_period
FROM `dqo-ai-testing`.`dqo_ai_test_data`.`test_average_delay_5877745271850405297` AS analyzed_table
GROUP BY time_period
ORDER BY time_period
SELECT
TIMESTAMP_DIFF(CURRENT_TIMESTAMP(),
SAFE_CAST(MAX(analyzed_table.dates) AS TIMESTAMP),
HOUR) AS actual_value, CAST(CURRENT_TIMESTAMP() AS date) AS time_period
FROM `dqo-ai-testing`.`dqo_ai_test_data`.`test_average_delay_5877745271850405297` AS analyzed_table
GROUP BY time_period
ORDER BY time_period