I have created an alert on top of "Query Metrics" System Activity Explore to alert when History.RunTime is > 120 seconds.
This is the exact SQL query being used as per the Explore:
SELECT
(FORMAT_TIMESTAMP('%F %T',
history.CREATED_AT
)) AS history_created_time,
query_metrics.artifact_id AS query_metrics_artifact_id,
query.id AS query_id,
COALESCE(SUM(CAST(
history.runtime
AS NUMERIC)), 0) AS runtime_in_seconds
FROM query_metrics
LEFT JOIN history ON query_metrics.query_task_id = history.slug
LEFT JOIN query ON history.query_id = query.id
WHERE (
history.runtime
) >= 5 AND (history.SOURCE ) = 'dashboard' AND (history.connection_name) = '<db_connection>' AND (((
history.CREATED_AT
) >= ((TIMESTAMP_ADD(CURRENT_TIMESTAMP(), INTERVAL -3599 SECOND))) AND (
history.CREATED_AT
) < ((TIMESTAMP_ADD(TIMESTAMP_ADD(CURRENT_TIMESTAMP(), INTERVAL -3599 SECOND), INTERVAL 3600 SECOND)))))
GROUP BY
1,
2,
3
ORDER BY
1
LIMIT 500
The problem is that the alert is using cached data and is not triggering the alert as indicated in this Alert Activity screenshot:
Why would the Alert use cached query when the filter parameters (timestamp parameters) will be changed every time the alert runs the query?
Is there a way to configure the Alert to not use Cache ?
The caching Policy cannot be modified as its a System Activity Explore
Hello,
This is behaving as expected, the system activity explores have specific caching policies to ensure database performance, outlined below. As the query SQL has not changed, the cache is used for these alerts. https://cloud.google.com/looker/docs/usage-reports-with-system-activity-explores#system_activity_exp...