mirror of
https://github.com/appwrite/appwrite.git
synced 2026-05-26 13:51:13 +00:00
Merge pull request #11244 from appwrite/simplify-messaging-span-country-codes
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user