@php $s = $report['summary']; // 1234 => "1.23 s", 234 => "234 ms" $ms = function ($value) { if ($value === null) { return '-'; } return $value >= 1000 ? number_format($value / 1000, 2) . ' s' : number_format($value) . ' ms'; }; // Change vs previous value, red when it got worse $delta = function ($current, $previous, $higherIsWorse = true, $suffix = '%') { if ($previous === null || $previous == 0) { return ''; } $change = round((($current - $previous) / $previous) * 100, 1); if ($change == 0) { return "(0{$suffix})"; } $worse = $higherIsWorse ? $change > 0 : $change < 0; $color = $worse ? '#c0392b' : '#27ae60'; $sign = $change > 0 ? '+' : ''; return "({$sign}{$change}{$suffix})"; }; $statusColors = ['Critical' => '#c0392b', 'Warning' => '#e67e22', 'Good' => '#27ae60', 'Low volume' => '#888888']; $hourLabel = function ($hour) { return str_pad($hour, 2, '0', STR_PAD_LEFT) . ':00'; }; $prev = $s['previous']; @endphp

Daily API Performance Report - {{ $report['date_label'] }}

Full day 00:00 - 23:59 (app timezone) · Generated {{ $report['generated_at'] }}
{{-- Summary --}}

Summary

{{ number_format($s['calls']) }}
Requests {!! $prev ? $delta($s['calls'], $prev['calls'], false) : '' !!}
{{ number_format($s['unique_users']) }}
Unique users {!! $prev ? $delta($s['unique_users'], $prev['unique_users'], false) : '' !!}
{{ $ms($s['p95']) }}
p95 latency {!! $prev ? $delta($s['p95'], $prev['p95']) : '' !!}
{{ $s['rate_5xx'] }}%
5xx rate{{ $prev ? " (prev {$prev['rate_5xx']}%)" : '' }}
{{ $s['rate_4xx'] }}%
4xx rate{{ $prev ? " (prev {$prev['rate_4xx']}%)" : '' }}
{{ $s['critical'] }} / {{ $s['warning'] }}
Critical / Warning of {{ $s['endpoints'] }} endpoints
Latency p50 {{ $ms($s['p50']) }} · p99 {{ $ms($s['p99']) }} · max {{ $ms($s['max']) }}. Peak hour {{ $hourLabel($s['peak_hour']) }}: {{ number_format($s['peak_hour_stats']['calls']) }} requests, p95 {{ $ms($s['peak_hour_stats']['p95']) }}, 5xx {{ $s['peak_hour_stats']['rate_5xx'] }}%.
{{-- Needs attention --}}

Needs attention ({{ count($report['attention']) }})

@if (count($report['attention'])) @foreach ($report['attention'] as $row) @endforeach
Endpoint Status Reason Calls p50 p95 p99 Max p95 vs 7d 5xx % Worst hour
{{ $row['method'] }} {{ $row['url'] }} {{ $row['status'] }} {{ implode('; ', $row['reasons']) }} {{ number_format($row['calls']) }} {{ $ms($row['p50']) }} {{ $ms($row['p95']) }} {{ $ms($row['p99']) }} {{ $ms($row['max']) }} {!! $row['baseline_p95'] !== null ? $ms($row['baseline_p95']) . ' ' . $delta($row['p95'], $row['baseline_p95']) : '-' !!} {{ $row['rate_5xx'] }}% {{ $row['worst_hour'] ? $hourLabel($row['worst_hour']['hour']) . ' · p95 ' . $ms($row['worst_hour']['p95']) : '-' }}
@else

All endpoints within targets.

@endif {{-- Where server time goes --}}

Top endpoints by total server time

Calls × avg latency - best candidates for optimisation.
@foreach ($report['top_time'] as $row) @endforeach
Endpoint Calls Avg p95 Total time Share
{{ $row['method'] }} {{ $row['url'] }} {{ number_format($row['calls']) }} {{ $ms($row['avg']) }} {{ $ms($row['p95']) }} {{ number_format($row['total_ms'] / 60000, 1) }} min {{ $row['time_share'] }}%
{{-- Errors --}}

Top endpoints by errors

@if (count($report['top_errors'])) @foreach ($report['top_errors'] as $row) @endforeach
Endpoint Calls 5xx 5xx % 401/403 422 429 Other 4xx
{{ $row['method'] }} {{ $row['url'] }} {{ number_format($row['calls']) }} {{ number_format($row['count_5xx']) }} {{ $row['rate_5xx'] }}% {{ number_format($row['count_auth']) }} {{ number_format($row['count_422']) }} {{ number_format($row['count_429']) }} {{ number_format($row['count_4xx'] - $row['count_auth'] - $row['count_422'] - $row['count_429']) }}
@else

No 4xx / 5xx responses.

@endif {{-- Hourly --}}

Hourly traffic

@foreach ($report['hourly'] as $hour => $row) @endforeach
Hour Requests Avg p95 p99 5xx 5xx %
{{ $hourLabel($hour) }} {{ number_format($row['calls']) }} {{ $ms($row['avg']) }} {{ $ms($row['p95']) }} {{ $ms($row['p99']) }} {{ number_format($row['count_5xx']) }} {{ $row['rate_5xx'] }}%
{{-- App versions --}}

App versions

@foreach ($report['versions'] as $row) @endforeach
Version Requests Share p95 5xx % 4xx %
{{ $row['version'] }} {{ number_format($row['calls']) }} {{ $s['calls'] ? round(($row['calls'] / $s['calls']) * 100, 1) : 0 }}% {{ $ms($row['p95']) }} {{ $row['rate_5xx'] }}% {{ $row['rate_4xx'] }}%
{{-- All endpoints --}}

All endpoints ({{ count($report['endpoints']) }})

@foreach ($report['endpoints'] as $row) @endforeach
Endpoint Calls Users Avg p95 Max 5xx % 4xx % Status
{{ $row['method'] }} {{ $row['url'] }} {{ number_format($row['calls']) }} {{ number_format($row['unique_users']) }} {{ $ms($row['avg']) }} {{ $ms($row['p95']) }} {{ $ms($row['max']) }} {{ $row['rate_5xx'] }}% {{ $row['rate_4xx'] }}% {{ $row['status'] }}
Percentiles are estimated from latency buckets (50 ms steps up to 300 ms, coarser above), so they are approximate within a bucket. Status: Critical when 5xx ≥ {{ $report['config']['error_rate_critical'] }}% or p95 > 2× target; Warning when 5xx ≥ {{ $report['config']['error_rate_warning'] }}%, p95 > target (default {{ $report['config']['default_p95_ms'] }} ms) or p95 up ≥ {{ $report['config']['regression_pct'] }}% vs the 7-day average. Endpoints with fewer than {{ $report['config']['min_calls'] }} calls are not flagged.