Skip to content

Commit a0b40cd

Browse files
authored
Merge branch 'main' into feat/env-var-data-integrations
2 parents 227e0bf + b7846b0 commit a0b40cd

File tree

3 files changed

+12
-7
lines changed

3 files changed

+12
-7
lines changed

app/Actions/Notifications/SendWebhookTestNotification.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public function handle(array $webhooks)
3737
'ping' => $fakeResult->ping,
3838
'download' => $fakeResult->download,
3939
'upload' => $fakeResult->upload,
40-
'packetLoss' => $fakeResult->data['packetLoss'],
40+
'packet_loss' => $fakeResult->data['packetLoss'],
4141
'speedtest_url' => $fakeResult->data['result']['url'],
4242
'url' => url('/admin/results'),
4343
])

app/Jobs/Ookla/BenchmarkSpeedtestJob.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use App\Events\SpeedtestBenchmarking;
88
use App\Events\SpeedtestBenchmarkUnhealthy;
99
use App\Helpers\Benchmark;
10+
use App\Helpers\Number;
1011
use App\Models\Result;
1112
use App\Settings\ThresholdSettings;
1213
use Illuminate\Bus\Batchable;
@@ -83,7 +84,8 @@ private function benchmark(Result $result, ThresholdSettings $settings): array
8384
'bar' => 'min',
8485
'passed' => Benchmark::bitrate($result->download, ['value' => $settings->absolute_download, 'unit' => 'mbps']),
8586
'type' => 'absolute',
86-
'value' => $settings->absolute_download,
87+
'test_value' => Number::bitsToMagnitude(bits: $result->download_bits, precision: 0, magnitude: 'mbit'),
88+
'benchmark_value' => $settings->absolute_download,
8789
'unit' => 'mbps',
8890
]);
8991

@@ -97,7 +99,8 @@ private function benchmark(Result $result, ThresholdSettings $settings): array
9799
'bar' => 'min',
98100
'passed' => filter_var(Benchmark::bitrate($result->upload, ['value' => $settings->absolute_upload, 'unit' => 'mbps']), FILTER_VALIDATE_BOOLEAN),
99101
'type' => 'absolute',
100-
'value' => $settings->absolute_upload,
102+
'test_value' => Number::bitsToMagnitude(bits: $result->upload_bits, precision: 0, magnitude: 'mbit'),
103+
'benchmark_value' => $settings->absolute_upload,
101104
'unit' => 'mbps',
102105
]);
103106

@@ -111,7 +114,8 @@ private function benchmark(Result $result, ThresholdSettings $settings): array
111114
'bar' => 'max',
112115
'passed' => Benchmark::ping($result->ping, ['value' => $settings->absolute_ping]),
113116
'type' => 'absolute',
114-
'value' => $settings->absolute_ping,
117+
'test_value' => round($result->ping),
118+
'benchmark_value' => $settings->absolute_ping,
115119
'unit' => 'ms',
116120
]);
117121

app/Listeners/ProcessCompletedSpeedtest.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,10 +162,11 @@ private function notifyWebhookChannels(Result $result): void
162162
'site_name' => config('app.name'),
163163
'server_name' => Arr::get($result->data, 'server.name'),
164164
'server_id' => Arr::get($result->data, 'server.id'),
165+
'status' => $result->status,
165166
'isp' => Arr::get($result->data, 'isp'),
166-
'ping' => $result->ping,
167-
'download' => $result->downloadBits,
168-
'upload' => $result->uploadBits,
167+
'ping' => round($result->ping),
168+
'download' => Number::bitsToMagnitude(bits: $result->download_bits, precision: 0, magnitude: 'mbit'),
169+
'upload' => Number::bitsToMagnitude(bits: $result->upload_bits, precision: 0, magnitude: 'mbit'),
169170
'packet_loss' => Arr::get($result->data, 'packetLoss'),
170171
'speedtest_url' => Arr::get($result->data, 'result.url'),
171172
'url' => url('/admin/results'),

0 commit comments

Comments
 (0)