From 5ff8ac46aa794417c48272d692da2a409133cb20 Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Tue, 18 Oct 2022 08:28:12 +0000 Subject: [PATCH] fix negative stats --- src/Appwrite/Usage/Stats.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Appwrite/Usage/Stats.php b/src/Appwrite/Usage/Stats.php index 06d43ea0c9..ba68d9ddf6 100644 --- a/src/Appwrite/Usage/Stats.php +++ b/src/Appwrite/Usage/Stats.php @@ -155,7 +155,7 @@ class Stats foreach ($storageMertics as $metric) { $value = $this->params[$metric] ?? 0; - if ($value >= 1 || $value == -1) { + if ($value >= 1 || $value == -1 || $value < -1) { $storageTags = $tags . ",bucketId=" . ($this->params['bucketId'] ?? ''); $this->statsd->count($metric . $storageTags, $value); } @@ -188,11 +188,11 @@ class Stats $deploymentSize = $this->params['deployment.{scope}.storage.size'] ?? 0; $storageSize = $this->params['files.{scope}.storage.size'] ?? 0; - if ($deploymentSize + $storageSize > 0) { + if ($deploymentSize + $storageSize > 0 || $deploymentSize + $storageSize <= -1) { $this->statsd->count('project.{scope}.storage.size' . $tags, $deploymentSize + $storageSize); } - if ($deploymentSize > 0) { + if ($deploymentSize > 0 || $deploymentSize <= -1) { $this->statsd->count('deployments.{scope}.storage.size' . $functionTags, $deploymentSize); }