diff options
author | Christopher Baines <mail@cbaines.net> | 2020-04-26 07:37:12 +0100 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2020-04-26 13:48:37 +0100 |
commit | 99080d5fd5341cd229515a79170790f89c958c67 (patch) | |
tree | 2662bef64ae1b271013543fe52d4de94b4a0e392 /guix-build-coordinator/agent-messaging | |
parent | e44f7a520e136733738dbebe6e3055e44bb46e7d (diff) | |
download | build-coordinator-99080d5fd5341cd229515a79170790f89c958c67.tar build-coordinator-99080d5fd5341cd229515a79170790f89c958c67.tar.gz |
Expose metrics
Diffstat (limited to 'guix-build-coordinator/agent-messaging')
-rw-r--r-- | guix-build-coordinator/agent-messaging/http.scm | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/guix-build-coordinator/agent-messaging/http.scm b/guix-build-coordinator/agent-messaging/http.scm index 8fba5c2..a561b18 100644 --- a/guix-build-coordinator/agent-messaging/http.scm +++ b/guix-build-coordinator/agent-messaging/http.scm @@ -40,6 +40,7 @@ #:use-module (guix build utils) #:use-module (guix-build-coordinator utils) #:use-module (guix-build-coordinator datastore) + #:use-module (guix-build-coordinator metrics) #:use-module (guix-build-coordinator coordinator) #:export (http-agent-messaging-start-server @@ -125,6 +126,16 @@ port. Also, the port used can be changed by passing the --port option.\n" (lambda (port) (scm->json json port)))) +(define* (render-text text #:key (extra-headers '()) + (code 200)) + (list (build-response + #:code code + #:headers (append extra-headers + '((content-type . (text/plain)) + (vary . (accept))))) + (lambda (port) + (display text port)))) + (define (no-content) (list (build-response #:code 204) "")) @@ -253,6 +264,9 @@ port. Also, the port used can be changed by passing the --port option.\n" (render-json "access denied" #:code 403)))) + (('GET "metrics") + (render-text + (metrics datastore))) (_ (render-json "not-found" |