'Referrers', 'browser' => 'Browsers', 'os' => 'Operating systems', ]; $approxBadge = fn (string $tooltip) => '~ approximate'; $serverListboxOptions = array_merge( [['value' => '', 'label' => 'All servers']], collect($serverOptions)->map(fn ($name, $uuid) => ['value' => $uuid, 'label' => $name])->values()->all(), ); $appListboxOptions = array_merge( [['value' => '', 'label' => 'All applications']], $appGroupedOptions, ); ?>
@if ($scopedServerUuid === null) Analytics | Coolify @endif {{-- Header --}}
@if ($scopedServerUuid === null)

Analytics

Request traffic across every application and server, reported by Sentinel.

@endif @if ($servers->isNotEmpty() && $overview)
@if ($scopedServerUuid === null)
@endif {{-- Re-key on the server filter so the application listbox re-initializes with the newly-scoped options (and reset value) instead of showing stale Alpine state. --}}
@include('livewire.traffic._live-toggle')
@endif
{{-- Nudge: enabled-eligible servers that haven't turned traffic analytics on yet. --}} @if ($scopedServerUuid === null && ! empty($eligibleDisabledServers))

{{ count($eligibleDisabledServers) === 1 ? '1 server can start collecting traffic analytics' : count($eligibleDisabledServers).' servers can start collecting traffic analytics' }}

Enabling regenerates the proxy config and restarts the proxy + Sentinel (a brief blip). Works with Traefik & Caddy.

@endif @if ($servers->isEmpty()) @if ($scopedServerUuid === null) View servers @endif @elseif (! $overview) @else @if ($this->isLivePollable()) @endif {{-- KPIs --}}
Requests {{ number_format($overview['requests'] ?? 0) }}
@include('livewire.traffic._sparkline', [ 'id' => $chartId.'-spark-requests', 'initial' => $this->requestsSpark(), 'colorVar' => '--chart-status-3xx', 'event' => 'refreshChartData-'.$chartId.'-status', 'key' => 'requestsSpark', ])
Unique visitors @if ($uniquesApproximate) {!! $approxBadge('Summed across servers; visitors seen on multiple servers may be double-counted.') !!} @endif {{ number_format($overview['uniqueVisitors'] ?? 0) }}
@include('livewire.traffic._sparkline', [ 'id' => $chartId.'-spark-visitors', 'initial' => $this->uniquesSpark(), 'colorVar' => '--chart-status-2xx', 'event' => 'refreshChartData-'.$chartId.'-status', 'key' => 'uniquesSpark', ])
Bandwidth {{ formatBytes($this->bandwidthBytes()) }}
@include('livewire.traffic._sparkline', [ 'id' => $chartId.'-spark-bandwidth', 'initial' => $this->bandwidthSpark(), 'colorVar' => '--chart-spark-bandwidth', 'event' => 'refreshChartData-'.$chartId.'-status', 'key' => 'bandwidthSpark', ])
Error rate {{ $this->errorRate() }}%
@include('livewire.traffic._sparkline', [ 'id' => $chartId.'-spark-errors', 'initial' => $this->errorsSpark(), 'colorVar' => '--chart-status-5xx', 'event' => 'refreshChartData-'.$chartId.'-status', 'key' => 'errorsSpark', ])
p95 latency @if ($latencyApproximate) {!! $approxBadge('Highest p95 latency across servers; not a true cross-server percentile.') !!} @endif {{ number_format($overview['latencyP95'] ?? 0, 1) }} ms
@include('livewire.traffic._sparkline', [ 'id' => $chartId.'-spark-latency', 'initial' => $this->latencySpark(), 'colorVar' => '--chart-status-4xx', 'event' => 'refreshChartData-'.$chartId.'-status', 'key' => 'latencySpark', ])
{{-- Requests over time (single area series). --}} @include('livewire.traffic._requests-chart') {{-- Status codes: stacked bar of responses by status class. --}} @include('livewire.traffic._status-codes') {{-- Top applications + Top hosts side by side; Top paths spans full width below. When filtered to one app, only Top paths applies. --}}
$appUuid === ''])> @if ($appUuid === '') @include('livewire.traffic._hosts-list', ['hosts' => $topHosts]) @if (empty($topApps)) @else @php $maxAppRequests = max(1, (int) collect($topApps)->max('requests')); @endphp
@foreach ($topApps as $row) @php $appHref = $row['link'] ?? null; $appWidth = min(100, round(($row['requests'] / $maxAppRequests) * 100, 1)); @endphp <{{ $appHref ? 'a' : 'div' }} wire:key="analytics-app-{{ $row['uuid'] }}" @if ($appHref) href="{{ $appHref }}" {{ wireNavigate() }} @endif x-show="{{ $loop->index }} >= page * per && {{ $loop->index }} < (page + 1) * per" @class([ 'flex min-h-11 items-center gap-3 border-b border-neutral-200 px-4 py-2 last:border-b-0 dark:border-white/[0.07]', 'transition-colors hover:bg-neutral-50 dark:hover:bg-white/[0.03]' => $appHref, ])> {{ $row['name'] }} @if (! empty($row['domain'])) @endif {{ compactNumber($row['requests']) }} @if ($appHref) @endif @endforeach @include('livewire.traffic._pager')
@endif
@endif
{{-- Top paths (full width). --}} @include('livewire.traffic._paths-list', ['paths' => $topPaths]) {{-- Countries --}} @include('livewire.traffic._geo', [ 'countries' => data_get($breakdowns, 'country', []), 'attribution' => $attribution, ]) {{-- Requests by device type (donut) + HTTP versions / cache / status. --}}
@php $deviceChart = $this->deviceChartData(); @endphp @include('livewire.traffic._device-chart', [ 'labels' => $deviceChart['labels'], 'series' => $deviceChart['series'], ]) @include('livewire.traffic._breakdown-section', [ 'dimension' => 'protocol', 'label' => 'Top HTTP versions', 'rows' => data_get($breakdowns, 'protocol', []), 'helper' => 'Request volume by negotiated HTTP protocol version.', ])
@include('livewire.traffic._breakdown-section', [ 'dimension' => 'cache', 'label' => 'Top cache statuses', 'rows' => data_get($breakdowns, 'cache', []), 'helper' => 'Reverse-proxy cache outcome (hit, miss, bypass, …) by request count.', ]) @include('livewire.traffic._breakdown-section', [ 'dimension' => 'status', 'label' => 'Top status codes', 'rows' => data_get($breakdowns, 'status', []), 'helper' => 'Most frequent HTTP response status codes for the selected range.', ])
{{-- Referrers / browsers / OS / AI agents / IPs, two per row. --}}
@foreach ($dimensionLabels as $dimension => $label) @include('livewire.traffic._breakdown-section', [ 'dimension' => $dimension, 'label' => $label, 'rows' => data_get($breakdowns, $dimension, []), ]) @endforeach @include('livewire.traffic._breakdown-section', [ 'dimension' => 'agent', 'label' => 'AI agents & bots', 'rows' => data_get($breakdowns, 'agent', []), 'helper' => 'Bot and AI-crawler traffic (GPTBot, ClaudeBot, Googlebot, …) by request count.', ]) @include('livewire.traffic._breakdown-section', [ 'dimension' => 'ip', 'label' => 'Top IPs', 'rows' => data_get($breakdowns, 'ip', []), 'helper' => 'Busiest client IPs (real visitor IP, resolved behind Cloudflare / reverse proxies).', ])
{{-- User agents (full width — raw UA strings are long). --}} @include('livewire.traffic._breakdown-section', [ 'dimension' => 'useragent', 'label' => 'Top user agents', 'rows' => data_get($breakdowns, 'useragent', []), 'helper' => 'Most frequent raw User-Agent strings for the selected range.', ]) @endif