mirror of
https://github.com/pterodactyl/panel.git
synced 2026-11-30 11:25:52 -05:00
Co-authored-by: Anthony <anthony@infraly.co> Co-authored-by: Sky Mulley <daniel.mulley@outlook.com>
31 lines
713 B
PHP
31 lines
713 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Pterodactyl\Actions\Telemetry;
|
|
|
|
use Exception;
|
|
use Illuminate\Support\Facades\Http;
|
|
use Pterodactyl\Contracts\Telemetry\SendsTelemetry;
|
|
use Pterodactyl\Services\Telemetry\TelemetryCollectionService;
|
|
|
|
final readonly class SendTelemetry implements SendsTelemetry
|
|
{
|
|
public function __construct(private TelemetryCollectionService $telemetry) {}
|
|
|
|
public function send(): void
|
|
{
|
|
try {
|
|
$data = $this->telemetry->collect();
|
|
} catch (Exception) {
|
|
return;
|
|
}
|
|
|
|
try {
|
|
Http::timeout(5)->post('https://telemetry.pterodactyl.io', $data);
|
|
} catch (Exception) {
|
|
return;
|
|
}
|
|
}
|
|
}
|