From 44226178dbf6ef10d20079148d8b4284ff226207 Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Sat, 4 Jan 2025 12:20:36 +0530 Subject: [PATCH] chore: add group to usage event --- src/Appwrite/Event/Usage.php | 16 ++++++++++++++++ src/Appwrite/Platform/Workers/UsageDump.php | 1 - 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/Appwrite/Event/Usage.php b/src/Appwrite/Event/Usage.php index 89e900d2ab..761c9400c8 100644 --- a/src/Appwrite/Event/Usage.php +++ b/src/Appwrite/Event/Usage.php @@ -51,6 +51,22 @@ class Usage extends Event return $this; } + /** + * Add group. + * + * @param string $key + * @return self + */ + public function addGroup(string $key): self + { + + $this->metrics[] = [ + 'group' => $key, + ]; + + return $this; + } + /** * Sends metrics to the usage worker. * diff --git a/src/Appwrite/Platform/Workers/UsageDump.php b/src/Appwrite/Platform/Workers/UsageDump.php index 3e50ba0363..b9d81f6c13 100644 --- a/src/Appwrite/Platform/Workers/UsageDump.php +++ b/src/Appwrite/Platform/Workers/UsageDump.php @@ -78,7 +78,6 @@ class UsageDump extends Action /** * End temp bug fallback */ - $numberOfKeys = !empty($stats['keys']) ? count($stats['keys']) : 0; $receivedAt = $stats['receivedAt'] ?? 'NONE'; if ($numberOfKeys === 0) {