aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--nar-herder/server.scm13
-rw-r--r--nar-herder/storage.scm10
2 files changed, 17 insertions, 6 deletions
diff --git a/nar-herder/server.scm b/nar-herder/server.scm
index f9a8c32..2e2c1e7 100644
--- a/nar-herder/server.scm
+++ b/nar-herder/server.scm
@@ -817,10 +817,15 @@
(lambda ()
(match (get-message addition-channel)
(('addition file)
- ;; TODO Check if the file is actually not stored
- (update-nar-files-metric metrics-registry
- '()
- #:not-stored-addition-count 1)
+ (apply update-nar-files-metric
+ metrics-registry
+ '()
+ (if (and canonical-storage
+ (file-exists?
+ (string-append canonical-storage
+ (uri-decode file))))
+ '(#:stored-addition-count 1)
+ '(#:not-stored-addition-count 1)))
(when mirror-channel
(spawn-fiber
diff --git a/nar-herder/storage.scm b/nar-herder/storage.scm
index df8ec4d..e85d745 100644
--- a/nar-herder/storage.scm
+++ b/nar-herder/storage.scm
@@ -207,7 +207,8 @@
(define* (update-nar-files-metric metrics-registry
nar-file-counts
#:key fetched-count removed-count
- not-stored-addition-count)
+ not-stored-addition-count
+ stored-addition-count)
;; Avoid incrementing or decrementing the metric if it hasn't been
;; set yet
@@ -255,7 +256,12 @@
(when not-stored-addition-count
(metric-increment nar-files-metric
#:by not-stored-addition-count
- #:label-values '((stored . "false")))))))
+ #:label-values '((stored . "false"))))
+
+ (when stored-addition-count
+ (metric-increment nar-files-metric
+ #:by stored-addition-count
+ #:label-values '((stored . "true")))))))
(define (initialise-storage-metrics database storage-root metrics-registry)
;; Use a database transaction to block changes