feat(admin): analytics redis cache, shared ops health, ticket queue clarity
CI / check (push) Successful in 29s
Deploy / release (push) Skipped
Deploy / deploy (push) Successful in 1m25s
CI / deploy (push) Failing after 10s

Co-authored-by: Cursor <[email protected]>
This commit is contained in:
SimoandCursor committed 2026-07-30 19:57:00 +02:00
1 parent 474de0717b
commit 58fae1f90f
38 files changed
+348 -245

No files matched your search

+17 -31
View File
@@ -4,6 +4,7 @@ import { redirect } from "next/navigation";
import { getTranslations } from "next-intl/server";
import { Badge } from "@/components/ui/badge";
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
import { fetchOpsHealth } from "@/lib/admin/ops-health";
import { canAccess, getAdminContext, PERMS } from "@/lib/permissions";
import { prisma } from "@/lib/prisma";
import { HealthCheckClient } from "./health-check-client";
@@ -12,42 +13,27 @@ async function getDevOpsData() {
const now = Math.floor(Date.now() / 1000);
const dayAgo = now - 86400;
// DB health — simple count query
let dbStatus: "healthy" | "error" = "healthy";
let dbLatency = 0;
try {
const start = Date.now();
await prisma.user.count({ take: 1 });
dbLatency = Date.now() - start;
} catch {
dbStatus = "error";
}
// Recent emulator errors
const recentErrors = await prisma.emulatorErrors.findMany({
orderBy: { id: "desc" },
take: 20,
});
const errorsToday = await prisma.emulatorErrors.count({
where: { timestamp: { gte: dayAgo } },
});
// Emulator settings (version info)
const emuVersion = await prisma.emulatorSettings.findFirst({
where: { key: "version" },
});
// Online user count as proxy for emulator health
const onlineUsers = await prisma.user.count({ where: { online: "1" } });
const [health, recentErrors, errorsToday, emuVersion] = await Promise.all([
fetchOpsHealth(),
prisma.emulatorErrors.findMany({
orderBy: { id: "desc" },
take: 20,
}),
prisma.emulatorErrors.count({
where: { timestamp: { gte: dayAgo } },
}),
prisma.emulatorSettings.findFirst({
where: { key: "version" },
}),
]);
return {
dbStatus,
dbLatency,
dbStatus: health.dbOk ? ("healthy" as const) : ("error" as const),
dbLatency: health.dbLatencyMs,
recentErrors,
errorsToday,
emuVersion: emuVersion?.value ?? "Unknown",
onlineUsers,
onlineUsers: health.onlineUsers,
};
}