feat(devops): separate public page server timing diagnostics
This commit is contained in:
1 parent
d5091d1a73
commit
baeb54aeb5
15 files changed
+315
-29
No files matched your search
@@ -13,9 +13,16 @@ export default async function PerformancePage({
|
||||
if (!canAccess(permissions, PERMS.DEVOPS_VIEW, session.user.rank))
|
||||
redirect("/admin");
|
||||
const t = await getTranslations("pages.admin.performance");
|
||||
const { samples, shared } = await readPerformance();
|
||||
const params = await searchParams;
|
||||
const kind = params.kind === "public-page" ? "public-page" : "admin-api";
|
||||
const { samples, shared } = await readPerformance(kind);
|
||||
const query = (typeof params.q === "string" ? params.q : "").slice(0, 100);
|
||||
const refreshParams = new URLSearchParams({
|
||||
kind,
|
||||
q: query,
|
||||
sort: params.sort === "recent" ? "recent" : "slowest",
|
||||
slow: params.slow === "1" ? "1" : "0",
|
||||
});
|
||||
const visible = samples.filter(
|
||||
(sample) =>
|
||||
`${sample.route} ${sample.operationId}`.includes(query) &&
|
||||
@@ -36,7 +43,10 @@ export default async function PerformancePage({
|
||||
<Link href="/admin/devops" className="btn btn-outline">
|
||||
DevOps
|
||||
</Link>
|
||||
<Link href="/admin/devops/performance" className="btn btn-outline">
|
||||
<Link
|
||||
href={`/admin/devops/performance?${refreshParams}`}
|
||||
className="btn btn-outline"
|
||||
>
|
||||
{t("refresh")}
|
||||
</Link>
|
||||
</div>
|
||||
@@ -44,6 +54,15 @@ export default async function PerformancePage({
|
||||
{t(shared ? "shared" : "local")} {t("retention")}
|
||||
</p>
|
||||
<form className="admin-card flex flex-wrap gap-3">
|
||||
<select
|
||||
name="kind"
|
||||
defaultValue={kind}
|
||||
aria-label={t("kind")}
|
||||
className="input"
|
||||
>
|
||||
<option value="admin-api">{t("adminApi")}</option>
|
||||
<option value="public-page">{t("publicPage")}</option>
|
||||
</select>
|
||||
<input
|
||||
name="q"
|
||||
defaultValue={query}
|
||||
@@ -71,10 +90,13 @@ export default async function PerformancePage({
|
||||
<option value="1">{t("slow")}</option>
|
||||
</select>
|
||||
<button className="btn btn-primary" type="submit">
|
||||
{t("search")}
|
||||
{t("applyFilters")}
|
||||
</button>
|
||||
</form>
|
||||
<p className="text-sm text-muted-foreground">{t("explanation")}</p>
|
||||
{kind === "public-page" && (
|
||||
<p className="text-sm text-muted-foreground">{t("publicBoundary")}</p>
|
||||
)}
|
||||
{visible.length === 0 ? (
|
||||
<p className="admin-card">{t("empty")}</p>
|
||||
) : (
|
||||
@@ -90,7 +112,10 @@ export default async function PerformancePage({
|
||||
{sample.method} {sample.route}
|
||||
</p>
|
||||
<p className="text-sm text-muted-foreground">
|
||||
{new Date(sample.at).toISOString()} · HTTP {sample.status}
|
||||
{new Date(sample.at).toISOString()} ·{" "}
|
||||
{sample.kind === "public-page"
|
||||
? t(`outcomes.${sample.outcome ?? "completed"}`)
|
||||
: `HTTP ${sample.status}`}
|
||||
</p>
|
||||
</div>
|
||||
<strong
|
||||
|
||||
Reference in new issue
Block a user