diff options
author | Christopher Baines <mail@cbaines.net> | 2024-04-15 13:54:25 +0100 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2024-04-15 13:54:25 +0100 |
commit | c18589249f4b78994db6715226334a28ae6bc85f (patch) | |
tree | d8d8e18057423acd5f2d7802ce70c08b2f7e39d6 /guix-data-service/web | |
parent | f1add8886761f2e6aec3563562b724a886fbe85b (diff) | |
download | data-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.scm | 16 |
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 |