aboutsummaryrefslogtreecommitdiff
path: root/guix-build-coordinator/agent-messaging
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2023-11-17 10:05:20 +0000
committerChristopher Baines <mail@cbaines.net>2023-11-17 10:05:20 +0000
commit5392d396d98a1b94854c2446a39794495a4afb0c (patch)
tree23a6d3caa15bb171652d15977c0fae940ed51031 /guix-build-coordinator/agent-messaging
parent65a178695938daff138a30293b3b7d28427a8791 (diff)
downloadbuild-coordinator-5392d396d98a1b94854c2446a39794495a4afb0c.tar
build-coordinator-5392d396d98a1b94854c2446a39794495a4afb0c.tar.gz
Track the metrics endpoint duration
Diffstat (limited to 'guix-build-coordinator/agent-messaging')
-rw-r--r--guix-build-coordinator/agent-messaging/http/server.scm32
1 files changed, 18 insertions, 14 deletions
diff --git a/guix-build-coordinator/agent-messaging/http/server.scm b/guix-build-coordinator/agent-messaging/http/server.scm
index 66b8f87..7bfc0b5 100644
--- a/guix-build-coordinator/agent-messaging/http/server.scm
+++ b/guix-build-coordinator/agent-messaging/http/server.scm
@@ -997,21 +997,25 @@ INTERVAL (a time-duration object), otherwise does nothing and returns #f."
'(("error" . "access denied"))
#:code 403))))
(('GET "metrics")
- (with-fibers-timeout
+ (call-with-duration-metric
+ (build-coordinator-metrics-registry build-coordinator)
+ "metrics_duration_seconds"
(lambda ()
- (call-with-delay-logging update-managed-metrics!
- #:threshold 0.5))
- #:timeout 8
- #:on-timeout (const #f))
-
- (list (build-response
- #:code 200
- #:headers '((content-type . (text/plain))
- (vary . (accept))))
- (lambda (port)
- (write-metrics (build-coordinator-metrics-registry
- build-coordinator)
- port))))
+ (with-fibers-timeout
+ (lambda ()
+ (call-with-delay-logging update-managed-metrics!
+ #:threshold 0.5))
+ #:timeout 8
+ #:on-timeout (const #f))
+
+ (list (build-response
+ #:code 200
+ #:headers '((content-type . (text/plain))
+ (vary . (accept))))
+ (lambda (port)
+ (write-metrics (build-coordinator-metrics-registry
+ build-coordinator)
+ port))))))
(_
(render-json
"not-found"