[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
11/11: Split the jobs metric in to succeede, queued and failed
From: |
Christopher Baines |
Subject: |
11/11: Split the jobs metric in to succeede, queued and failed |
Date: |
Fri, 9 Oct 2020 15:21:21 -0400 (EDT) |
cbaines pushed a commit to branch master
in repository data-service.
commit 4f3be14c1691e475210bda21671f337e5943178b
Author: Christopher Baines <mail@cbaines.net>
AuthorDate: Fri Oct 9 20:19:28 2020 +0100
Split the jobs metric in to succeede, queued and failed
Rather than just completed or not.
---
guix-data-service/jobs/load-new-guix-revision.scm | 21 ++++++++++++++++++---
guix-data-service/web/controller.scm | 4 ++--
2 files changed, 20 insertions(+), 5 deletions(-)
diff --git a/guix-data-service/jobs/load-new-guix-revision.scm
b/guix-data-service/jobs/load-new-guix-revision.scm
index 691cda1..c399763 100644
--- a/guix-data-service/jobs/load-new-guix-revision.scm
+++ b/guix-data-service/jobs/load-new-guix-revision.scm
@@ -1365,7 +1365,22 @@ RETURNING id;")
(define query
"
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(*)
FROM load_new_guix_revision_jobs
INNER JOIN git_repositories
@@ -1374,9 +1389,9 @@ INNER JOIN git_repositories
GROUP BY 1, 2")
(map (match-lambda
- ((label completed count)
+ ((label state count)
(list label
- (string=? "t" completed)
+ state
(string->number count))))
(exec-query conn query)))
diff --git a/guix-data-service/web/controller.scm
b/guix-data-service/web/controller.scm
index 4727771..6adc093 100644
--- a/guix-data-service/web/controller.scm
+++ b/guix-data-service/web/controller.scm
@@ -223,13 +223,13 @@
pg-stat-user-indexes-metrics)
(for-each (match-lambda
- ((repository-label completed count)
+ ((repository-label state count)
(metric-set
load-new-guix-revision-job-count
count
#:label-values
`((repository_label . ,repository-label)
- (completed . ,(if completed "yes" "no"))))))
+ (state . ,state)))))
load-new-guix-revision-job-metrics)
(list (build-response
- 01/11: Guard against derivation IDs that aren't numbers, (continued)
- 01/11: Guard against derivation IDs that aren't numbers, Christopher Baines, 2020/10/09
- 02/11: Guard against errors when recording job stderr output, Christopher Baines, 2020/10/09
- 04/11: Change the derivation comparison targets, Christopher Baines, 2020/10/09
- 03/11: Link to the revisions in the comparison header, Christopher Baines, 2020/10/09
- 05/11: Use letpar& for systems and targets in render-compare/derivations, Christopher Baines, 2020/10/09
- 06/11: Clarify that the derivations comparison only is for packages, Christopher Baines, 2020/10/09
- 08/11: Include tablespace as a label for table metrics, Christopher Baines, 2020/10/09
- 09/11: Include the base commit and target commit in the compare output, Christopher Baines, 2020/10/09
- 07/11: Improve select-job-for-commit, Christopher Baines, 2020/10/09
- 10/11: Add Prometheus metrics for indexes specifically, Christopher Baines, 2020/10/09
- 11/11: Split the jobs metric in to succeede, queued and failed,
Christopher Baines <=