aboutsummaryrefslogtreecommitdiff
path: root/guix-build-coordinator/agent-messaging
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2020-05-19 19:14:06 +0100
committerChristopher Baines <mail@cbaines.net>2020-05-19 19:14:06 +0100
commite6f614ee3ec21cba1a3f3da90aebbdea1535dde0 (patch)
treea94005b2be8b26fc69199ae8eb05533a2387e4a1 /guix-build-coordinator/agent-messaging
parent6bfc8020d81d7b295aea41aabd0a2dc4d5e614dc (diff)
downloadbuild-coordinator-e6f614ee3ec21cba1a3f3da90aebbdea1535dde0.tar
build-coordinator-e6f614ee3ec21cba1a3f3da90aebbdea1535dde0.tar.gz
Zero the allocated build counts as well
Diffstat (limited to 'guix-build-coordinator/agent-messaging')
-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