mirror of
https://github.com/coollabsio/coolify.git
synced 2026-11-06 13:10:37 -04:00
Every released Sentinel with traffic analytics (1.0.0 and later) has the dashboard and series routes and the requests, bytes_in and app fields, so the fallbacks for builds without them are not needed. - Keep "no data" handling for Sentinel without traffic routes (0.0.x) - Keep the resource-scope fallback, which Sentinel 1.0.1 needs
35 lines
992 B
PHP
35 lines
992 B
PHP
<?php
|
|
|
|
namespace App\Data\Traffic;
|
|
|
|
use Spatie\LaravelData\Data;
|
|
|
|
class TrafficPathData extends Data
|
|
{
|
|
public function __construct(
|
|
public string $path,
|
|
public int $requests,
|
|
public int $bytesOut,
|
|
public int $s4xx,
|
|
public int $s5xx,
|
|
public float $p50,
|
|
public float $p95,
|
|
// Owning app key, so the UI can show the domain of each path row.
|
|
public string $app = '',
|
|
) {}
|
|
|
|
public static function fromSentinel(array $row): self
|
|
{
|
|
return new self(
|
|
path: (string) data_get($row, 'path', ''),
|
|
requests: (int) data_get($row, 'requests', 0),
|
|
bytesOut: (int) data_get($row, 'bytes_out', 0),
|
|
s4xx: (int) data_get($row, 's4xx', 0),
|
|
s5xx: (int) data_get($row, 's5xx', 0),
|
|
p50: (float) data_get($row, 'p50', 0.0),
|
|
p95: (float) data_get($row, 'p95', 0.0),
|
|
app: (string) data_get($row, 'app', ''),
|
|
);
|
|
}
|
|
}
|