aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2025-05-21 17:57:12 +0100
committerChristopher Baines <mail@cbaines.net>2025-05-21 18:03:02 +0100
commit586982fc7e9591351dffe1a234fa088a889d97fb (patch)
tree40a2163343e9aa7c8dfc5f85dfa5b929f8a3706d
parent1a8193fb2cf156793b74e28baac12112442f423f (diff)
downloadnar-herder-586982fc7e9591351dffe1a234fa088a889d97fb.tar
nar-herder-586982fc7e9591351dffe1a234fa088a889d97fb.tar.gz
Instrument write response exceptions
-rw-r--r--nar-herder/server.scm8
1 files changed, 8 insertions, 0 deletions
diff --git a/nar-herder/server.scm b/nar-herder/server.scm
index a22d507..7e7ef64 100644
--- a/nar-herder/server.scm
+++ b/nar-herder/server.scm
@@ -26,6 +26,7 @@
#:use-module (ice-9 iconv)
#:use-module (ice-9 match)
#:use-module (ice-9 threads)
+ #:use-module (ice-9 exceptions)
#:use-module (ice-9 binary-ports)
#:use-module (rnrs bytevectors)
#:use-module (web uri)
@@ -631,6 +632,9 @@
#:namespace
"narherder"))
+ (define write-response-exception-metric
+ (make-gauge-metric metrics-registry "write_response_exception_count"))
+
(and=>
(assq-ref opts 'mirror)
(lambda (mirror)
@@ -944,6 +948,10 @@
maybe-trigger-creation-of-cached-nars
#:cached-compression-nar-requested-hook
cached-compression-nar-requested-hook)
+ #:write-response-exception-handler
+ (lambda (exn request)
+ (metric-increment write-response-exception-metric)
+ (default-write-response-exception-handler exn request))
#:host (assq-ref opts 'host)
#:port (assq-ref opts 'port))