Skip to content

Commit c1a45e3

Browse files
Merge pull request #31 from matomo-org/fix-timeout-log-level
Change API timeout to 5 seconds and log level to info and error
2 parents 3da42f1 + e8e09db commit c1a45e3

11 files changed

+12
-9
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
## Changelog
22

3+
5.0.4 - 2026-01-05
4+
- Updated Api timeout to 5 seconds and changed log levels
5+
36
5.0.3 - 2025-11-10
47
- Updated cover image for marketplace
58
- Updated screenshot to not include extra plugins

Slack.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ public function sendNewAlerts($triggeredAlerts): void
429429
foreach ($groupedAlerts as $slackChannelId => $alert) {
430430
if (!$slackApi->sendMessage(implode("\n", $alert['message']), $slackChannelId)) {
431431
$logger = StaticContainer::get(LoggerInterface::class);
432-
$logger->debug('Slack alert failed for following alerts: ' . implode("\n", $alert['name']));
432+
$logger->info('Slack alert failed for following alerts: ' . implode("\n", $alert['name']));
433433
}
434434
}
435435
}

SlackApi.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class SlackApi
3636
private const SLACK_COMPLETE_UPLOAD_EXTERNAL = 'https://slack.com/api/files.completeUploadExternal';
3737
private const SLACK_POST_MESSAGE_URL = 'https://slack.com/api/chat.postMessage';
3838

39-
private const SLACK_TIMEOUT = 5000;
39+
private const SLACK_TIMEOUT = 5;
4040

4141
public function __construct(
4242
#[\SensitiveParameter]
@@ -60,7 +60,7 @@ public function uploadFile(string $subject, string $fileName, string $fileConten
6060
return $this->completeUploadExternal($channel, $subject);
6161
}
6262

63-
$this->logger->debug('Unable to send ' . $fileName . ' report to Slack');
63+
$this->logger->info('Unable to send ' . $fileName . ' report to Slack');
6464

6565
return false;
6666
}
@@ -87,7 +87,7 @@ public function getUploadURLExternal(string $fileName, int $fileLength): string
8787
['Content-Type' => 'multipart/form-data']
8888
);
8989
} catch (\Exception $e) {
90-
$this->logger->debug('Slack error getUploadURLExternal: ' . $e->getMessage());
90+
$this->logger->error('Slack error getUploadURLExternal: ' . $e->getMessage());
9191
return '';
9292
}
9393

@@ -120,7 +120,7 @@ public function sendFile(string $uploadURL, string $fileContents): bool
120120
true
121121
);
122122
} catch (\Exception $e) {
123-
$this->logger->debug('Slack error sendFile: ' . $e->getMessage());
123+
$this->logger->error('Slack error sendFile: ' . $e->getMessage());
124124
return false;
125125
}
126126

@@ -151,7 +151,7 @@ public function completeUploadExternal(string $channel, string $subject): bool
151151
['Content-Type' => 'multipart/form-data']
152152
);
153153
} catch (\Exception $e) {
154-
$this->logger->debug('Slack error completeUploadExternal:' . $e->getMessage());
154+
$this->logger->error('Slack error completeUploadExternal:' . $e->getMessage());
155155
return false;
156156
}
157157

@@ -171,7 +171,7 @@ public function completeUploadExternal(string $channel, string $subject): bool
171171
public function sendMessage(string $message, string $channel): bool
172172
{
173173
if (empty($message) || empty($channel)) {
174-
$this->logger->debug('Empty message or channel for sending message');
174+
$this->logger->info('Empty message or channel for sending message');
175175
return false;
176176
}
177177

@@ -187,7 +187,7 @@ public function sendMessage(string $message, string $channel): bool
187187
['Content-Type' => 'multipart/form-data']
188188
);
189189
} catch (\Exception $e) {
190-
$this->logger->debug('Slack error sendMessage:' . $e->getMessage());
190+
$this->logger->error('Slack error sendMessage:' . $e->getMessage());
191191
return false;
192192
}
193193

plugin.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "Slack",
33
"description": "Send Matomo reports and alerts to Slack channels, keeping your team informed and ready to act in real time.",
4-
"version": "5.0.3",
4+
"version": "5.0.4",
55
"theme": false,
66
"require": {
77
"matomo": ">=5.0.0,<6.0.0-b1"
6.94 KB
Loading
5.72 KB
Loading
6.79 KB
Loading
5.72 KB
Loading
6.93 KB
Loading
5.72 KB
Loading

0 commit comments

Comments
 (0)