Update pgboss column names for v12 (snake_case)

pg-boss v11 renamed every concatenated-lowercase timestamp column
(`createdon`, `completedon`) to snake_case (`created_on`,
`completed_on`). Our service-health dashboard and failed-job alert
still referenced the v10 names, so after the v12 upgrade those
queries error out silently.

Fix the three affected queries:
- alerts.yml: failed-job alert
- service-health.json: "Recent Failed Jobs" table
- service-health.json: "Job Queue — Completed/hour" time series

The `state` / `name` / `output` columns stay the same, and the `state`
enum still accepts `'failed'` / `'completed'` literals.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Ullrich Schäfer 2026-04-20 16:49:43 +02:00
parent 9d22ae5510
commit 875665de66
No known key found for this signature in database
GPG key ID: A32FF691A0F752D9
2 changed files with 3 additions and 3 deletions

View file

@ -517,7 +517,7 @@
"type": "postgres", "type": "postgres",
"uid": "postgres" "uid": "postgres"
}, },
"rawSql": "SELECT name, state, createdon, completedon, output::text AS error FROM pgboss.job WHERE state = 'failed' AND completedon > now() - interval '24 hours' ORDER BY completedon DESC LIMIT 20", "rawSql": "SELECT name, state, created_on, completed_on, output::text AS error FROM pgboss.job WHERE state = 'failed' AND completed_on > now() - interval '24 hours' ORDER BY completed_on DESC LIMIT 20",
"format": "table" "format": "table"
} }
] ]
@ -538,7 +538,7 @@
"type": "postgres", "type": "postgres",
"uid": "postgres" "uid": "postgres"
}, },
"rawSql": "SELECT date_trunc('hour', completedon) AS time, name, count(*) AS completed FROM pgboss.job WHERE state = 'completed' AND completedon > now() - interval '24 hours' GROUP BY 1, 2 ORDER BY 1", "rawSql": "SELECT date_trunc('hour', completed_on) AS time, name, count(*) AS completed FROM pgboss.job WHERE state = 'completed' AND completed_on > now() - interval '24 hours' GROUP BY 1, 2 ORDER BY 1",
"format": "time_series" "format": "time_series"
} }
] ]

View file

@ -161,7 +161,7 @@ groups:
relativeTimeRange: { from: 3600, to: 0 } relativeTimeRange: { from: 3600, to: 0 }
datasourceUid: postgres datasourceUid: postgres
model: model:
rawSql: "SELECT count(*) AS failed FROM pgboss.job WHERE state = 'failed' AND completedon > now() - interval '1 hour'" rawSql: "SELECT count(*) AS failed FROM pgboss.job WHERE state = 'failed' AND completed_on > now() - interval '1 hour'"
format: table format: table
- refId: B - refId: B
datasourceUid: __expr__ datasourceUid: __expr__