aboutsummaryrefslogtreecommitdiff
path: root/guix-data-service/web
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2024-04-15 13:54:25 +0100
committerChristopher Baines <mail@cbaines.net>2024-04-15 13:54:25 +0100
commitc18589249f4b78994db6715226334a28ae6bc85f (patch)
treed8d8e18057423acd5f2d7802ce70c08b2f7e39d6 /guix-data-service/web
parentf1add8886761f2e6aec3563562b724a886fbe85b (diff)
downloaddata-service-c18589249f4b78994db6715226334a28ae6bc85f.tar
data-service-c18589249f4b78994db6715226334a28ae6bc85f.tar.gz
Instrument the resource pool checkout timeouts
Diffstat (limited to 'guix-data-service/web')
-rw-r--r--guix-data-service/web/server.scm16
1 files changed, 16 insertions, 0 deletions
diff --git a/guix-data-service/web/server.scm b/guix-data-service/web/server.scm
index d0be4e4..4f2a4a0 100644
--- a/guix-data-service/web/server.scm
+++ b/guix-data-service/web/server.scm
@@ -142,6 +142,22 @@
(resource-pool-default-timeout 5))
+ (let ((resource-pool-checkout-failures-metric
+ (make-counter-metric registry
+ "resource_pool_checkout_timeouts_total"
+ #:labels '(pool_name))))
+ (%resource-pool-timeout-handler
+ (lambda (pool proc timeout)
+ (let ((pool-name
+ (cond
+ ((eq? pool (connection-pool)) "normal")
+ ((eq? pool (reserved-connection-pool)) "reserved")
+ (else #f))))
+ (when pool-name
+ (metric-increment
+ resource-pool-checkout-failures-metric
+ #:label-values `((pool_name . ,pool-name))))))))
+
(spawn-fiber
(lambda ()
(with-resource-from-pool (connection-pool) conn