aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--guix-build-coordinator/agent-messaging/http.scm16
1 files changed, 10 insertions, 6 deletions
diff --git a/guix-build-coordinator/agent-messaging/http.scm b/guix-build-coordinator/agent-messaging/http.scm
index 6c67d0d..2ca2ed3 100644
--- a/guix-build-coordinator/agent-messaging/http.scm
+++ b/guix-build-coordinator/agent-messaging/http.scm
@@ -174,16 +174,19 @@ port. Also, the port used can be changed by passing the --port option.\n"
(string-append namespace
"_build_allocation_plan_total")
#:labels '(agent_id))))
- (lambda ()
- (metric-set builds-total
- (datastore-count-builds datastore))
-
+ (define (zero-metric-for-agents metric)
(for-each (lambda (agent-details)
- (metric-set allocated-builds-total
+ (metric-set metric
0
#:label-values
`((agent_id . ,(assq-ref agent-details 'uuid)))))
- (datastore-list-agents datastore))
+ (datastore-list-agents datastore)))
+
+ (lambda ()
+ (metric-set builds-total
+ (datastore-count-builds datastore))
+
+ (zero-metric-for-agents allocated-builds-total)
(for-each (match-lambda
((agent-id . count)
(metric-set allocated-builds-total
@@ -207,6 +210,7 @@ port. Also, the port used can be changed by passing the --port option.\n"
`((agent_id . ,agent-id)
(reason . ,reason)))))
(datastore-count-setup-failures datastore))
+ (zero-metric-for-agents allocated-builds-total)
(for-each (match-lambda
((agent-id . count)
(metric-set build-allocation-plan-total