Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@ yarn-error.log
# AI and Boost assets
/.claude
/.github/copilot-instructions.md
/.github/skills
/.mcp.json
/.opencode
/boost.json
/AGENTS.md
/CLAUDE.md
/opencode.json
10 changes: 10 additions & 0 deletions app/Notifications/Apprise/SpeedtestNotification.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,16 @@ class SpeedtestNotification extends Notification implements ShouldQueue
{
use Queueable;

/**
* The number of times the job may be attempted.
* Set to 1 to prevent duplicate notifications.
* Apprise may take >30s to respond (timeout), but still processes successfully.
* See #2653 and #2615
*
* @var int
*/
public $tries = 1;

public function __construct(
public string $title,
public string $body,
Expand Down
10 changes: 10 additions & 0 deletions app/Notifications/Apprise/TestNotification.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,16 @@ class TestNotification extends Notification implements ShouldQueue
{
use Queueable;

/**
* The number of times the job may be attempted.
* Set to 1 to prevent duplicate notifications.
* Apprise may take >30s to respond (timeout), but still processes successfully.
* See #2653 and #2615
*
* @var int
*/
public $tries = 1;

/**
* Get the notification's delivery channels.
*
Expand Down
2 changes: 1 addition & 1 deletion app/Notifications/AppriseChannel.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function send(object $notifiable, Notification $notification): void
]);

try {
$request = Http::timeout(30)
$request = Http::timeout(60)
->withHeaders([
'Content-Type' => 'application/json',
]);
Expand Down
48 changes: 32 additions & 16 deletions app/Services/PrometheusMetricsService.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace App\Services;

use App\Enums\ResultStatus;
use App\Models\Result;
use App\Settings\DataIntegrationSettings;
use Illuminate\Support\Facades\Cache;
Expand Down Expand Up @@ -44,6 +45,21 @@ protected function registerMetrics(CollectorRegistry $registry, Result $result):
$labelNames = array_keys($labels);
$labelValues = array_values($labels);

// Info metric - always exported so users can see test status (including failures)
$infoGauge = $registry->getOrRegisterGauge(
'speedtest_tracker',
'result_id',
'Speedtest result id',
$labelNames
);
$infoGauge->set($result->id, $labelValues);

// Only export numeric metrics for completed tests
// Failed/incomplete tests won't have valid measurements
if ($result->status !== ResultStatus::Completed) {
return;
}

// Download speed in bytes
$downloadBytesGauge = $registry->getOrRegisterGauge(
'speedtest_tracker',
Expand Down Expand Up @@ -96,7 +112,7 @@ protected function registerMetrics(CollectorRegistry $registry, Result $result):
'Ping jitter in milliseconds',
$labelNames
);
$pingJitterGauge->set($result->ping_jitter ?? 0, $labelValues);
$pingJitterGauge->set($result->ping_jitter, $labelValues);

// Download jitter
$downloadJitterGauge = $registry->getOrRegisterGauge(
Expand All @@ -105,7 +121,7 @@ protected function registerMetrics(CollectorRegistry $registry, Result $result):
'Download jitter in milliseconds',
$labelNames
);
$downloadJitterGauge->set($result->download_jitter ?? 0, $labelValues);
$downloadJitterGauge->set($result->download_jitter, $labelValues);

// Upload jitter
$uploadJitterGauge = $registry->getOrRegisterGauge(
Expand All @@ -114,7 +130,7 @@ protected function registerMetrics(CollectorRegistry $registry, Result $result):
'Upload jitter in milliseconds',
$labelNames
);
$uploadJitterGauge->set($result->upload_jitter ?? 0, $labelValues);
$uploadJitterGauge->set($result->upload_jitter, $labelValues);

// Packet loss
$packetLossGauge = $registry->getOrRegisterGauge(
Expand All @@ -123,7 +139,7 @@ protected function registerMetrics(CollectorRegistry $registry, Result $result):
'Packet loss percentage',
$labelNames
);
$packetLossGauge->set($result->packet_loss ?? 0, $labelValues);
$packetLossGauge->set($result->packet_loss, $labelValues);

// Ping latency low/high
$pingLowGauge = $registry->getOrRegisterGauge(
Expand All @@ -132,15 +148,15 @@ protected function registerMetrics(CollectorRegistry $registry, Result $result):
'Ping low latency in milliseconds',
$labelNames
);
$pingLowGauge->set($result->ping_low ?? 0, $labelValues);
$pingLowGauge->set($result->ping_low, $labelValues);

$pingHighGauge = $registry->getOrRegisterGauge(
'speedtest_tracker',
'ping_high_ms',
'Ping high latency in milliseconds',
$labelNames
);
$pingHighGauge->set($result->ping_high ?? 0, $labelValues);
$pingHighGauge->set($result->ping_high, $labelValues);

// Download latency metrics (IQM = Interquartile Mean - more reliable than average)
$downloadLatencyIqmGauge = $registry->getOrRegisterGauge(
Expand All @@ -149,23 +165,23 @@ protected function registerMetrics(CollectorRegistry $registry, Result $result):
'Download latency interquartile mean in milliseconds',
$labelNames
);
$downloadLatencyIqmGauge->set($result->downloadlatencyiqm ?? 0, $labelValues);
$downloadLatencyIqmGauge->set($result->downloadlatencyiqm, $labelValues);

$downloadLatencyLowGauge = $registry->getOrRegisterGauge(
'speedtest_tracker',
'download_latency_low_ms',
'Download latency low in milliseconds',
$labelNames
);
$downloadLatencyLowGauge->set($result->downloadlatency_low ?? 0, $labelValues);
$downloadLatencyLowGauge->set($result->downloadlatency_low, $labelValues);

$downloadLatencyHighGauge = $registry->getOrRegisterGauge(
'speedtest_tracker',
'download_latency_high_ms',
'Download latency high in milliseconds',
$labelNames
);
$downloadLatencyHighGauge->set($result->downloadlatency_high ?? 0, $labelValues);
$downloadLatencyHighGauge->set($result->downloadlatency_high, $labelValues);

// Upload latency metrics
$uploadLatencyIqmGauge = $registry->getOrRegisterGauge(
Expand All @@ -174,23 +190,23 @@ protected function registerMetrics(CollectorRegistry $registry, Result $result):
'Upload latency interquartile mean in milliseconds',
$labelNames
);
$uploadLatencyIqmGauge->set($result->uploadlatencyiqm ?? 0, $labelValues);
$uploadLatencyIqmGauge->set($result->uploadlatencyiqm, $labelValues);

$uploadLatencyLowGauge = $registry->getOrRegisterGauge(
'speedtest_tracker',
'upload_latency_low_ms',
'Upload latency low in milliseconds',
$labelNames
);
$uploadLatencyLowGauge->set($result->uploadlatency_low ?? 0, $labelValues);
$uploadLatencyLowGauge->set($result->uploadlatency_low, $labelValues);

$uploadLatencyHighGauge = $registry->getOrRegisterGauge(
'speedtest_tracker',
'upload_latency_high_ms',
'Upload latency high in milliseconds',
$labelNames
);
$uploadLatencyHighGauge->set($result->uploadlatency_high ?? 0, $labelValues);
$uploadLatencyHighGauge->set($result->uploadlatency_high, $labelValues);

// Bytes transferred during test
$downloadedBytesGauge = $registry->getOrRegisterGauge(
Expand All @@ -199,15 +215,15 @@ protected function registerMetrics(CollectorRegistry $registry, Result $result):
'Total bytes downloaded during test',
$labelNames
);
$downloadedBytesGauge->set($result->downloaded_bytes ?? 0, $labelValues);
$downloadedBytesGauge->set($result->downloaded_bytes, $labelValues);

$uploadedBytesGauge = $registry->getOrRegisterGauge(
'speedtest_tracker',
'uploaded_bytes',
'Total bytes uploaded during test',
$labelNames
);
$uploadedBytesGauge->set($result->uploaded_bytes ?? 0, $labelValues);
$uploadedBytesGauge->set($result->uploaded_bytes, $labelValues);

// Test duration
$downloadElapsedGauge = $registry->getOrRegisterGauge(
Expand All @@ -216,15 +232,15 @@ protected function registerMetrics(CollectorRegistry $registry, Result $result):
'Download test duration in milliseconds',
$labelNames
);
$downloadElapsedGauge->set($result->download_elapsed ?? 0, $labelValues);
$downloadElapsedGauge->set($result->download_elapsed, $labelValues);

$uploadElapsedGauge = $registry->getOrRegisterGauge(
'speedtest_tracker',
'upload_elapsed_ms',
'Upload test duration in milliseconds',
$labelNames
);
$uploadElapsedGauge->set($result->upload_elapsed ?? 0, $labelValues);
$uploadElapsedGauge->set($result->upload_elapsed, $labelValues);
}

protected function buildLabels(Result $result): array
Expand Down
38 changes: 19 additions & 19 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,41 +16,41 @@
"require": {
"php": "^8.2",
"chrisullyott/php-filesize": "^4.2.1",
"codewithdennis/filament-simple-alert": "^4.0.2",
"codewithdennis/filament-simple-alert": "^4.0.5",
"dragonmantank/cron-expression": "^3.6.0",
"filament/filament": "4.1.0",
"filament/spatie-laravel-settings-plugin": "^4.1",
"filament/filament": "^4.6.3",
"filament/spatie-laravel-settings-plugin": "^4.6.3",
"influxdata/influxdb-client-php": "^3.8",
"laravel-notification-channels/telegram": "^6.0",
"laravel/framework": "^12.41.1",
"laravel/prompts": "^0.3.8",
"laravel/sanctum": "^4.2.1",
"livewire/livewire": "^3.7.1",
"laravel/framework": "^12.49.0",
"laravel/prompts": "^0.3.11",
"laravel/sanctum": "^4.3.0",
"livewire/livewire": "^3.7.8",
"lorisleiva/laravel-actions": "^2.9.1",
"maennchen/zipstream-php": "^2.4",
"promphp/prometheus_client_php": "^2.14.1",
"saloonphp/laravel-plugin": "^3.7",
"secondnetwork/blade-tabler-icons": "^3.35",
"saloonphp/laravel-plugin": "^3.8",
"secondnetwork/blade-tabler-icons": "^3.36.1",
"spatie/laravel-json-api-paginate": "^1.16.3",
"spatie/laravel-query-builder": "^6.3.6",
"spatie/laravel-query-builder": "^6.4.1",
"spatie/laravel-settings": "^3.6.0",
"spatie/laravel-webhook-server": "^3.8.3",
"spatie/ping": "^1.1.1",
"zircote/swagger-php": "^5.7.6"
"spatie/ping": "^1.2.0",
"zircote/swagger-php": "^5.8.0"
},
"require-dev": {
"fakerphp/faker": "^1.24.1",
"laravel/boost": "^1.8.3",
"laravel/boost": "^2.0.5",
"laravel/pail": "^1.2.4",
"laravel/pint": "^1.26.0",
"laravel/sail": "^1.50.0",
"laravel/telescope": "^5.15.1",
"laravel/tinker": "^2.10.2",
"laravel/pint": "^1.27.0",
"laravel/sail": "^1.52.0",
"laravel/telescope": "^5.16.1",
"laravel/tinker": "^2.11.0",
"mockery/mockery": "^1.6.12",
"nunomaduro/collision": "^8.8.3",
"pestphp/pest": "^3.8.4",
"pestphp/pest": "^3.8.5",
"pestphp/pest-plugin-laravel": "^3.2",
"spatie/laravel-ignition": "^2.9.1"
"spatie/laravel-ignition": "^2.10.0"
},
"autoload": {
"files": [
Expand Down
Loading