(int)($e['count'] ?? 1), $errors));
$lastIngest = $errors ? max(array_column($errors, 'ingested_at')) : null;
$totalSessions = count($sessions);
$byType = [];
$bySeverity = [];
$byCategory = [];
$byModule = [];
$byDay = [];
$topErrors = [];
foreach ($errors as $e) {
$t = $e['type'] ?? 'unknown';
$byType[$t] = ($byType[$t] ?? 0) + ($e['count'] ?? 1);
$s = $e['severity'] ?? 'error';
$bySeverity[$s] = ($bySeverity[$s] ?? 0) + ($e['count'] ?? 1);
$m = $e['module'] ?? 'unknown';
$byModule[$m] = ($byModule[$m] ?? 0) + ($e['count'] ?? 1);
$c = $e['category'] ?? 'runtime';
$byCategory[$c] = ($byCategory[$c] ?? 0) + ($e['count'] ?? 1);
$day = substr($e['ingested_at'] ?? $e['last_seen'], 0, 10);
$byDay[$day] = ($byDay[$day] ?? 0) + ($e['count'] ?? 1);
$hash = $e['hash'] ?? '';
if ($hash) {
if (!isset($topErrors[$hash])) {
$topErrors[$hash] = ['hash' => $hash, 'message' => $e['message'] ?? '', 'count' => 0, 'type' => $t];
}
$topErrors[$hash]['count'] += $e['count'] ?? 1;
}
}
usort($topErrors, fn($a, $b) => $b['count'] - $a['count']);
$topErrors = array_slice($topErrors, 0, 10);
ksort($byDay);
$recentSessions = array_slice($sessions, -10, 10, true);
?>
newOS4 Debug Dashboard
🔍 newOS4 Debug Dashboard
Last sync: = htmlspecialchars(substr($lastSync, 0, 19)) ?> UTC
Total Occurrences
= $totalOccurrences ?>
= $uniqueErrors ?> unique signatures
last ingest: = $lastIngest ? htmlspecialchars($lastIngest) : '—' ?>
Sessions
= $totalSessions ?>
Error Types
= count($byType) ?>
Modules Affected
= count($byModule) ?>
By Severity
'error', 'error' => 'error', 'warning' => 'warn'] as $sev => $cls): ?>
| = $sev ?> | = $bySeverity[$sev] ?? 0 ?> |
By Category
0): ?>
| = $cat ?> | = $byCategory[$cat] ?? 0 ?> |
By Module
$count):
if ($i++ > 5) break;
?>
| = htmlspecialchars($mod) ?> | = $count ?> |
Daily Trend (last 14 days)
| Day | Errors | |
$count):
$pct = round($count / $maxDay * 100, 0);
?>
| = $day ?> |
= $count ?> |
|
Recent Sessions
| Session | Version | Errors | Last Seen |
$s): ?>
| = htmlspecialchars($sid) ?> |
= htmlspecialchars($s['version'] ?? '?') ?> |
= $s['error_count'] ?? 0 ?> |
= htmlspecialchars(substr($s['last_seen'] ?? '', 0, 16)) ?> |
Auto-refresh every 30s