From e6f614ee3ec21cba1a3f3da90aebbdea1535dde0 Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Tue, 19 May 2020 19:14:06 +0100 Subject: Zero the allocated build counts as well --- guix-build-coordinator/agent-messaging/http.scm | 16 ++++++++++------ 1 file 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 -- cgit v1.2.3