diff options
Diffstat (limited to 'guix-build-coordinator/build-allocator.scm')
-rw-r--r-- | guix-build-coordinator/build-allocator.scm | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/guix-build-coordinator/build-allocator.scm b/guix-build-coordinator/build-allocator.scm index 94cfd03..0e65c4d 100644 --- a/guix-build-coordinator/build-allocator.scm +++ b/guix-build-coordinator/build-allocator.scm @@ -22,6 +22,7 @@ #:use-module (srfi srfi-1) #:use-module (srfi srfi-11) #:use-module (ice-9 match) + #:use-module (prometheus) #:use-module (guix memoization) #:use-module (guix-build-coordinator utils) #:use-module (guix-build-coordinator datastore) @@ -31,7 +32,8 @@ (define* (basic-build-allocation-strategy datastore #:key - (planned-builds-for-agent-limit 2048)) + (planned-builds-for-agent-limit 2048) + metrics-registry) (define (log . args) (when #f (simple-format #t "allocator: ~A\n" @@ -40,6 +42,14 @@ args) " ")))) + (define allocator-considered-builds-metric + (when metrics-registry + (let ((name "allocator_considered_builds")) + (or (metrics-registry-fetch-metric metrics-registry + name) + (make-gauge-metric metrics-registry + name))))) + (define cached/list-builds-for-output (mlambda (output) (datastore-list-builds-for-output datastore output))) @@ -197,6 +207,10 @@ required-build-id priority)))) + (when metrics-registry + (metric-set allocator-considered-builds-metric + (length builds))) + ;; Go through the setup failures and look specifically at the ;; missing_inputs ones. Eliminate any missing_inputs failures if all the ;; missing inputs appear to have been built successfully, and update the @@ -288,7 +302,8 @@ (define* (derivation-ordered-build-allocation-strategy datastore #:key - (planned-builds-for-agent-limit 2048)) + (planned-builds-for-agent-limit 2048) + metrics-registry) (define (log . args) (when #f (simple-format #t "allocator: ~A\n" @@ -297,6 +312,14 @@ args) " ")))) + (define allocator-considered-builds-metric + (when metrics-registry + (let ((name "allocator_considered_builds")) + (or (metrics-registry-fetch-metric metrics-registry + name) + (make-gauge-metric metrics-registry + name))))) + (let* ((agents (datastore-list-agents datastore)) (requested-systems-by-agent (map (lambda (agent-details) @@ -378,6 +401,10 @@ (b-priority (hash-ref derived-build-priorities-hash b))) (< b-priority a-priority)))) + (when metrics-registry + (metric-set allocator-considered-builds-metric + (length build-ids-for-unprocessed-builds-with-built-inputs))) + (let ((result (append-map (lambda (agent-id) |