From a18ea601681b79871dcbfe6858d21b5d098ff2ba Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Thu, 21 Apr 2022 11:16:21 +0000 Subject: [PATCH] fix storage.total usage --- app/tasks/usage.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/app/tasks/usage.php b/app/tasks/usage.php index 0aff6cf513..829914a706 100644 --- a/app/tasks/usage.php +++ b/app/tasks/usage.php @@ -757,7 +757,6 @@ $cli // aggregate storage.total = storage.files.total + storage.deployments.total if($metricPrefix === 'storage' && $subCollection === 'files') { - Console::info("Aggregating `storage.total`"); $metric = 'storage.total'; $time = (int) (floor(time() / 1800) * 1800); // Time rounded to nearest 30 minutes $id = \md5($time . '_30m_' . $metric); //Construct unique id for each metric using time, period and metric @@ -773,7 +772,7 @@ $cli ])); } else { $dbForProject->updateDocument('stats', $document->getId(), - $document->setAttribute('value', $count)); + $document->setAttribute('value', $count + $deploymentsTotal)); } $time = (int) (floor(time() / 86400) * 86400); // Time rounded to nearest day @@ -790,7 +789,7 @@ $cli ])); } else { $dbForProject->updateDocument('stats', $document->getId(), - $document->setAttribute('value', $count)); + $document->setAttribute('value', $count + $deploymentsTotal)); } } }