diff options
-rw-r--r-- | bffe.scm | 6 | ||||
-rw-r--r-- | bffe/manage-builds.scm | 16 |
2 files changed, 18 insertions, 4 deletions
@@ -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 |