diff --git a/src/Appwrite/Usage/Stats.php b/src/Appwrite/Usage/Stats.php index 00298238f..20ab58b68 100644 --- a/src/Appwrite/Usage/Stats.php +++ b/src/Appwrite/Usage/Stats.php @@ -109,6 +109,12 @@ class Stats if ($value >= 1) { $this->statsd->increment($metric . $tags); } + if($metric == $usersMetrics[0]) { + $this->statsd->increment('users.{scope}.count.total' . $tags); + } + if($metric == $usersMetrics[3]) { + $this->statsd->decrement('users.{scope}.count.total' . $tags); + } } $dbMetrics = [ @@ -131,6 +137,27 @@ class Stats if ($value >= 1) { $dbTags = $tags . ",collectionId=" . ($this->params['collectionId'] ?? '') . ",databaseId=" . ($this->params['databaseId'] ?? ''); $this->statsd->increment($metric . $dbTags); + + if($metric == $dbMetrics[0]) { + $this->statsd->increment('databases.{scope}.count.total' . $dbTags); + } + if($metric == $dbMetrics[3]) { + $this->statsd->decrement('databases.{scope}.count.total' . $dbTags); + } + + if($metric == $dbMetrics[4]) { + $this->statsd->increment('collections.{scope}.count.total' . $dbTags); + } + if($metric == $dbMetrics[7]) { + $this->statsd->decrement('collections.{scope}.count.total' . $dbTags); + } + + if($metric == $dbMetrics[8]) { + $this->statsd->increment('documents.{scope}.count.total' . $dbTags); + } + if($metric == $dbMetrics[11]) { + $this->statsd->decrement('documents.{scope}.count.total' . $dbTags); + } } } @@ -150,6 +177,20 @@ class Stats if ($value >= 1) { $storageTags = $tags . ",bucketId=" . ($this->params['bucketId'] ?? ''); $this->statsd->increment($metric . $storageTags); + + if($metric == $storageMertics[0]) { + $this->statsd->increment('buckets.{scope}.count.total' . $storageTags); + } + if($metric == $storageMertics[3]) { + $this->statsd->decrement('buckets.{scope}.count.total' . $storageTags); + } + + if($metric == $storageMertics[4]) { + $this->statsd->increment('files.{scope}.count.total' . $storageTags); + } + if($metric == $storageMertics[7]) { + $this->statsd->decrement('files.{scope}.count.total' . $storageTags); + } } }