diff --git a/examples/alerts/alerts.md b/examples/alerts/alerts.md index 7a9823939e..cb40e2a9f7 100644 --- a/examples/alerts/alerts.md +++ b/examples/alerts/alerts.md @@ -54,7 +54,7 @@ rules: - alert: ThanosCompactHasNotRun annotations: message: Thanos Compact {{$labels.job}} has not uploaded anything for 24 hours. - expr: (time() - max(thanos_objstore_bucket_last_successful_upload_time{job=~"thanos-compact.*"})) + expr: (time() - max(max_over_time(thanos_objstore_bucket_last_successful_upload_time{job=~"thanos-compact.*"}[24h]))) / 60 / 60 > 24 labels: severity: warning diff --git a/examples/alerts/alerts.yaml b/examples/alerts/alerts.yaml index 12b5132bc8..72c3279e49 100644 --- a/examples/alerts/alerts.yaml +++ b/examples/alerts/alerts.yaml @@ -47,7 +47,7 @@ groups: - alert: ThanosCompactHasNotRun annotations: message: Thanos Compact {{$labels.job}} has not uploaded anything for 24 hours. - expr: (time() - max(thanos_objstore_bucket_last_successful_upload_time{job=~"thanos-compact.*"})) + expr: (time() - max(max_over_time(thanos_objstore_bucket_last_successful_upload_time{job=~"thanos-compact.*"}[24h]))) / 60 / 60 > 24 labels: severity: warning diff --git a/mixin/alerts/compact.libsonnet b/mixin/alerts/compact.libsonnet index 87bcfa13a7..3fb8f474a5 100644 --- a/mixin/alerts/compact.libsonnet +++ b/mixin/alerts/compact.libsonnet @@ -73,7 +73,7 @@ annotations: { message: 'Thanos Compact {{$labels.job}} has not uploaded anything for 24 hours.', }, - expr: '(time() - max(thanos_objstore_bucket_last_successful_upload_time{%(selector)s})) / 60 / 60 > 24' % thanos.compact, + expr: '(time() - max(max_over_time(thanos_objstore_bucket_last_successful_upload_time{%(selector)s}[24h]))) / 60 / 60 > 24' % thanos.compact, labels: { severity: 'warning', },