Skip to content

Commit 913b76a

Browse files
authored
metrics(zebra): add 7-day filter to stuck jobs query (#615)
## 📝 Description The `stuck_jobs` query was updated to only include jobs started within the last 7 days. This prevents stale jobs from accumulating in the metric and triggering false alarms, making the metric more accurate for real time monitoring. More in [this issue](renderedtext/tasks#8656). ## ✅ Checklist - [ ] I have tested this change - [x] ~This change requires documentation update~ N/A
1 parent b49d8ae commit 913b76a

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

zebra/lib/zebra/monitor.ex

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,7 @@ defmodule Zebra.Monitor do
212212
def stuck_jobs do
213213
from(j in Job,
214214
where: j.aasm_state == "started",
215+
where: j.started_at > date_add(^Date.utc_today(), -7, "day"),
215216
where:
216217
fragment(
217218
"extract(epoch from ?) + coalesce(?, ?)",

0 commit comments

Comments
 (0)