aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2024-05-11 07:26:18 +0100
committerChristopher Baines <mail@cbaines.net>2024-05-11 07:26:18 +0100
commit06fca5d1772469d163bbf165801ed547e0290f1c (patch)
tree058db621130a8b05939acc421dcd7f42bae7bbaf
parenta8e97cb90db92230dbc10677cceac91709031766 (diff)
downloadbffe-06fca5d1772469d163bbf165801ed547e0290f1c.tar
bffe-06fca5d1772469d163bbf165801ed547e0290f1c.tar.gz
Instrument unseen revisions
-rw-r--r--bffe.scm6
-rw-r--r--bffe/manage-builds.scm16
2 files changed, 18 insertions, 4 deletions
diff --git a/bffe.scm b/bffe.scm
index 405937e..fa185ee 100644
--- a/bffe.scm
+++ b/bffe.scm
@@ -63,8 +63,10 @@
(lambda ()
(run-fibers
(lambda ()
- (for-each start-submit-builds-fibers
- build)
+ (for-each
+ (lambda (spec)
+ (start-submit-builds-fibers metrics-registry spec))
+ build)
(when web-server-args
(apply start-bffe-web-server
diff --git a/bffe/manage-builds.scm b/bffe/manage-builds.scm
index 0fbfc7d..b5d95bd 100644
--- a/bffe/manage-builds.scm
+++ b/bffe/manage-builds.scm
@@ -23,6 +23,7 @@
#:use-module (ice-9 exceptions)
#:use-module (ice-9 textual-ports)
#:use-module (logging logger)
+ #:use-module (prometheus)
#:use-module (zlib)
#:use-module (json)
#:use-module (fibers)
@@ -416,12 +417,19 @@
" package builds for " log-suffix))))
(define (submit-builds-pass
+ metrics-registry
submit-build/fiberized
guix-data-service
specification
processed-commits-hash
record-revision-as-processed
systems-and-targets)
+ (define unseen-revisions-metric
+ (or (metrics-registry-fetch-metric
+ metrics-registry "unseen_revisions_total")
+ (make-gauge-metric metrics-registry
+ "unseen_revisions_total")))
+
(fibers-for-each
(lambda (repository-id)
(fibers-for-each
@@ -449,6 +457,7 @@
"revisions")))))
(log-msg 'DEBUG (length unseen-revisions)
" unseen revisions")
+ (metric-set unseen-revisions-metric (length unseen-revisions))
(for-each
(lambda (commit)
(log-msg 'INFO "looking at revision " commit)
@@ -490,6 +499,7 @@
systems-and-targets)
(log-msg 'INFO "finished looking at revision " commit)
+ (metric-decrement unseen-revisions-metric)
(record-revision-as-processed commit))
(reverse unseen-revisions))))
(let ((all-branches (all-repository-branches guix-data-service
@@ -503,7 +513,8 @@
(sleep 60))
-(define* (start-submit-builds-fibers specification
+(define* (start-submit-builds-fibers metrics-registry
+ specification
#:key
processed-commits-file)
(define processed-commits-hash
@@ -585,7 +596,8 @@
(lambda ()
(with-throw-handler #t
(lambda ()
- (submit-builds-pass submit-build/fiberized
+ (submit-builds-pass metrics-registry
+ submit-build/fiberized
guix-data-service
specification
processed-commits-hash