Platform and reliability
The Spark job alert that paged nothing
A Spark job failed every run for a week and nobody was paged. Why, and how I rewrote the alerts to fire on real failures and clear on their own.
- 1 weekof failed runs with no page, before the fix
The problem
CubeCraft’s analytics run as Spark jobs on Kubernetes. The alert for them keyed on failed driver pods. A failed driver pod sticks around until the operator reaps it, so one bad run kept the alert firing for hours. It got noisy enough that it was muted.
Meanwhile one Spark app failed every run for a week, and nobody got paged.
What I built
- Alert rules keyed on each app’s liveness instead of on leftover pods, so an alert clears on the next good run
- A replay of the new expression against the failure window, to confirm it caught exactly that app and nothing else
- A related fix: Apache Doris write-lock timeouts were tripping the Spark apps’ failure threshold and shutting them down. I left those tasks to Spark’s own retries, counted them in the failure report, and added the end reason to every task-failure alert
- Run failsdriver pod stays Failed
- Old rulecount of failed pods > 0
- Fires for hoursuntil the pod is reaped
- Mutedreal failures page nobody
- Each applast success time
- New ruleno success within its schedule
- Firesonly for an app that's actually down
- Clearson the next good run
The rule, in spirit
# before: latches until cleanup
alert SparkJobFailed
if count(driver_pods{phase="Failed"}) > 0
# after: per app, based on when it last worked
alert SparkAppNotSucceeding
if time() - last_success_timestamp{app} > expected_interval{app} * 2
for 15m
labels: app, end_reason
What I took from it
A muted alert is worse than no alert, because everyone assumes it’s still watching. If an alert doesn’t clear on its own, people will mute it.