Split the jobs metric in to succeede, queued and failed
Rather than just completed or not.
This commit is contained in:
parent
5267bde603
commit
4f3be14c16
2 changed files with 20 additions and 5 deletions
|
|
@ -1365,7 +1365,22 @@ RETURNING id;")
|
||||||
(define query
|
(define query
|
||||||
"
|
"
|
||||||
SELECT COALESCE(git_repositories.label, git_repositories.url) AS repository_label,
|
SELECT COALESCE(git_repositories.label, git_repositories.url) AS repository_label,
|
||||||
succeeded_at IS NOT NULL AS completed,
|
CASE WHEN succeeded_at IS NOT NULL
|
||||||
|
THEN 'succeeded'
|
||||||
|
WHEN (
|
||||||
|
SELECT COUNT(*)
|
||||||
|
FROM load_new_guix_revision_job_events
|
||||||
|
WHERE job_id = load_new_guix_revision_jobs.id
|
||||||
|
AND event = 'retry'
|
||||||
|
) >= (
|
||||||
|
SELECT COUNT(*)
|
||||||
|
FROM load_new_guix_revision_job_events
|
||||||
|
WHERE job_id = load_new_guix_revision_jobs.id
|
||||||
|
AND event = 'failure'
|
||||||
|
)
|
||||||
|
THEN 'queued'
|
||||||
|
ELSE 'failed'
|
||||||
|
END AS state,
|
||||||
COUNT(*)
|
COUNT(*)
|
||||||
FROM load_new_guix_revision_jobs
|
FROM load_new_guix_revision_jobs
|
||||||
INNER JOIN git_repositories
|
INNER JOIN git_repositories
|
||||||
|
|
@ -1374,9 +1389,9 @@ INNER JOIN git_repositories
|
||||||
GROUP BY 1, 2")
|
GROUP BY 1, 2")
|
||||||
|
|
||||||
(map (match-lambda
|
(map (match-lambda
|
||||||
((label completed count)
|
((label state count)
|
||||||
(list label
|
(list label
|
||||||
(string=? "t" completed)
|
state
|
||||||
(string->number count))))
|
(string->number count))))
|
||||||
(exec-query conn query)))
|
(exec-query conn query)))
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -223,13 +223,13 @@
|
||||||
pg-stat-user-indexes-metrics)
|
pg-stat-user-indexes-metrics)
|
||||||
|
|
||||||
(for-each (match-lambda
|
(for-each (match-lambda
|
||||||
((repository-label completed count)
|
((repository-label state count)
|
||||||
(metric-set
|
(metric-set
|
||||||
load-new-guix-revision-job-count
|
load-new-guix-revision-job-count
|
||||||
count
|
count
|
||||||
#:label-values
|
#:label-values
|
||||||
`((repository_label . ,repository-label)
|
`((repository_label . ,repository-label)
|
||||||
(completed . ,(if completed "yes" "no"))))))
|
(state . ,state)))))
|
||||||
load-new-guix-revision-job-metrics)
|
load-new-guix-revision-job-metrics)
|
||||||
|
|
||||||
(list (build-response
|
(list (build-response
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue