From 4ef43aacd93099116097b5b5e9d28b519f738b57 Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Wed, 4 Feb 2026 15:18:28 +0530 Subject: [PATCH] Simplify country code span logging for internal SMS messages Internal SMS always has a single recipient, so remove the unnecessary count-based tracking and simplify to just log the country code directly. --- src/Appwrite/Platform/Workers/Messaging.php | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/src/Appwrite/Platform/Workers/Messaging.php b/src/Appwrite/Platform/Workers/Messaging.php index 15cd876b89..f09a67755a 100644 --- a/src/Appwrite/Platform/Workers/Messaging.php +++ b/src/Appwrite/Platform/Workers/Messaging.php @@ -432,18 +432,11 @@ class Messaging extends Action private function sendInternalSMSMessage(Document $message, Document $project, array $recipients, Log $log): void { Span::add('providerType', 'sms'); - Span::add('recipientsCount', \count($recipients)); - // Extract country codes from phone numbers - $countryCodes = []; - foreach ($recipients as $recipient) { - $countryCode = $this->extractCountryCode($recipient); - if ($countryCode !== null) { - $countryCodes[$countryCode] = ($countryCodes[$countryCode] ?? 0) + 1; - } - } - foreach ($countryCodes as $code => $count) { - Span::add('countryCode_' . $code, $count); + // Extract country code from the single recipient phone number + $countryCode = $this->extractCountryCode($recipients[0] ?? ''); + if ($countryCode !== null) { + Span::add('countryCode', $countryCode); } if ($this->adapter === null) {