aboutsummaryrefslogtreecommitdiff
path: root/guix-build-coordinator/agent-messaging/http.scm
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2020-05-23 09:12:46 +0100
committerChristopher Baines <mail@cbaines.net>2020-05-23 09:12:46 +0100
commit82809c55e59d2c4e7c25398c3e7ae58d7042a3cd (patch)
tree0d53da6a5465cf3c18174defe324e2d83d7cae4a /guix-build-coordinator/agent-messaging/http.scm
parent06c30f561d2080ff7f18715e9956866004636716 (diff)
downloadbuild-coordinator-82809c55e59d2c4e7c25398c3e7ae58d7042a3cd.tar
build-coordinator-82809c55e59d2c4e7c25398c3e7ae58d7042a3cd.tar.gz
Track unprocessed hook events by event
Diffstat (limited to 'guix-build-coordinator/agent-messaging/http.scm')
-rw-r--r--guix-build-coordinator/agent-messaging/http.scm18
1 files changed, 15 insertions, 3 deletions
diff --git a/guix-build-coordinator/agent-messaging/http.scm b/guix-build-coordinator/agent-messaging/http.scm
index 54a04ee..b74e114 100644
--- a/guix-build-coordinator/agent-messaging/http.scm
+++ b/guix-build-coordinator/agent-messaging/http.scm
@@ -178,7 +178,8 @@ port. Also, the port used can be changed by passing the --port option.\n"
(unprocessed-hook-events-total
(make-gauge-metric registry
(string-append namespace
- "_unprocessed_hook_events_total"))))
+ "_unprocessed_hook_events_total")
+ #:labels '(event))))
(define (zero-metric-for-agents metric)
(for-each (lambda (agent-details)
(metric-set metric
@@ -224,8 +225,19 @@ port. Also, the port used can be changed by passing the --port option.\n"
`((agent_id . ,agent-id)))))
(datastore-count-build-allocation-plan-entries datastore))
- (metric-set unprocessed-hook-events-total
- (datastore-count-unprocessed-hook-events datastore)))))
+ (for-each (match-lambda
+ ((event . _)
+ (metric-set unprocessed-hook-events-total
+ 0
+ #:label-values
+ `((event . ,event)))))
+ (build-coordinator-hooks build-coordinator))
+ (for-each (lambda (event-count)
+ (metric-set unprocessed-hook-events-total
+ (assq-ref event-count 'count)
+ #:label-values
+ `((event . ,(assq-ref event-count 'event)))))
+ (datastore-count-unprocessed-hook-events datastore)))))
(define (controller request
method-and-path-components