diff options
author | Christopher Baines <mail@cbaines.net> | 2022-01-20 12:22:01 +0000 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2022-01-20 12:22:01 +0000 |
commit | f01812ad8a40d71933b245bf9d58f5e124b86cd0 (patch) | |
tree | bc7d6d015fe206c95279824b1708780517240381 /guix-build-coordinator | |
parent | ce094ab4696509afe4fa51be3d02bc2135df1e95 (diff) | |
download | build-coordinator-f01812ad8a40d71933b245bf9d58f5e124b86cd0.tar build-coordinator-f01812ad8a40d71933b245bf9d58f5e124b86cd0.tar.gz |
Tweak metrics delay logging
Just instrument the update-managed-metrics! function, and move some code
around so this is clearer in the logs.
Diffstat (limited to 'guix-build-coordinator')
-rw-r--r-- | guix-build-coordinator/agent-messaging/http/server.scm | 39 |
1 files changed, 19 insertions, 20 deletions
diff --git a/guix-build-coordinator/agent-messaging/http/server.scm b/guix-build-coordinator/agent-messaging/http/server.scm index 255d105..5edfaa0 100644 --- a/guix-build-coordinator/agent-messaging/http/server.scm +++ b/guix-build-coordinator/agent-messaging/http/server.scm @@ -75,16 +75,16 @@ if there was no request body." (define (http-agent-messaging-start-server port host secret-key-base build-coordinator chunked-request-channel) - (define update-managed-metrics! - (let ((datastore-metrics-updater - (base-datastore-metrics-updater build-coordinator)) - (gc-metrics-updater - (get-gc-metrics-updater - (build-coordinator-metrics-registry build-coordinator)))) - (lambda () - (call-with-delay-logging datastore-metrics-updater) - (gc-metrics-updater)))) + (define gc-metrics-updater + (get-gc-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-error-handling (lambda () @@ -659,17 +659,16 @@ port. Also, the port used can be changed by passing the --port option.\n" '(("error" . "access denied")) #:code 403)))) (('GET "metrics") - (call-with-delay-logging - (lambda () - (update-managed-metrics!) - (list (build-response - #:code 200 - #:headers '((content-type . (text/plain)) - (vary . (accept)))) - (lambda (port) - (write-metrics (build-coordinator-metrics-registry - build-coordinator) - port)))))) + (call-with-delay-logging update-managed-metrics! + #:threshold 0) + (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" |