diff options
author | Christopher Baines <mail@cbaines.net> | 2023-04-27 12:19:53 +0200 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2023-04-27 12:19:53 +0200 |
commit | fb4332d436dfb730424008f68eef0e4dff6ba6ac (patch) | |
tree | 2b5bd37e05925ea3f09e199937a0da6cbb00e8d7 /guix-build-coordinator | |
parent | 6151b2e0e2c907eb847c5e1d5dc929f89008fdd1 (diff) | |
download | build-coordinator-fb4332d436dfb730424008f68eef0e4dff6ba6ac.tar build-coordinator-fb4332d436dfb730424008f68eef0e4dff6ba6ac.tar.gz |
Try to instrument ports/file descriptors
I'm seeing "too many open file" errors, and while I'm not sure if
port-for-each is directly connected, it sounds like it might be worth
instrumenting.
Diffstat (limited to 'guix-build-coordinator')
-rw-r--r-- | guix-build-coordinator/agent-messaging/http/server.scm | 7 | ||||
-rw-r--r-- | guix-build-coordinator/utils.scm | 12 |
2 files changed, 18 insertions, 1 deletions
diff --git a/guix-build-coordinator/agent-messaging/http/server.scm b/guix-build-coordinator/agent-messaging/http/server.scm index 4c88428..d2f4e2d 100644 --- a/guix-build-coordinator/agent-messaging/http/server.scm +++ b/guix-build-coordinator/agent-messaging/http/server.scm @@ -81,12 +81,17 @@ if there was no request body." (get-gc-metrics-updater (build-coordinator-metrics-registry build-coordinator))) + (define port-metrics-updater + (get-port-metrics-updater + (build-coordinator-metrics-registry build-coordinator))) + (define datastore-metrics-updater (base-datastore-metrics-updater build-coordinator)) (define (update-managed-metrics!) (call-with-delay-logging datastore-metrics-updater) - (call-with-delay-logging gc-metrics-updater)) + (call-with-delay-logging gc-metrics-updater) + (call-with-delay-logging port-metrics-updater)) (call-with-error-handling (lambda () diff --git a/guix-build-coordinator/utils.scm b/guix-build-coordinator/utils.scm index b044718..edcc129 100644 --- a/guix-build-coordinator/utils.scm +++ b/guix-build-coordinator/utils.scm @@ -88,6 +88,7 @@ running-on-the-hurd? get-gc-metrics-updater + get-port-metrics-updater get-guix-memory-metrics-updater check-locale! @@ -1334,6 +1335,17 @@ again." (metric-set metric value)))) metrics)))) +(define (get-port-metrics-updater registry) + (let ((count-metric + (make-gauge-metric registry "guile_ports_total"))) + (lambda () + (let ((count 0)) + (port-for-each + (lambda _ + (set! count (+ 1 count)))) + + (metric-set count-metric count))))) + (define (get-guix-memory-metrics-updater registry) (define %memoization-tables (@@ (guix memoization) %memoization-tables)) |