mirror of
https://github.com/prometheus/prometheus.git
synced 2025-03-05 20:59:13 -08:00
Some checks failed
CI / Go tests (push) Has been cancelled
CI / More Go tests (push) Has been cancelled
CI / Go tests with previous Go version (push) Has been cancelled
CI / UI tests (push) Has been cancelled
CI / Go tests on Windows (push) Has been cancelled
CI / Mixins tests (push) Has been cancelled
CI / Build Prometheus for common architectures (0) (push) Has been cancelled
CI / Build Prometheus for common architectures (1) (push) Has been cancelled
CI / Build Prometheus for common architectures (2) (push) Has been cancelled
CI / Build Prometheus for all architectures (0) (push) Has been cancelled
CI / Build Prometheus for all architectures (1) (push) Has been cancelled
CI / Build Prometheus for all architectures (10) (push) Has been cancelled
CI / Build Prometheus for all architectures (11) (push) Has been cancelled
CI / Build Prometheus for all architectures (2) (push) Has been cancelled
CI / Build Prometheus for all architectures (3) (push) Has been cancelled
CI / Build Prometheus for all architectures (4) (push) Has been cancelled
CI / Build Prometheus for all architectures (5) (push) Has been cancelled
CI / Build Prometheus for all architectures (6) (push) Has been cancelled
CI / Build Prometheus for all architectures (7) (push) Has been cancelled
CI / Build Prometheus for all architectures (8) (push) Has been cancelled
CI / Build Prometheus for all architectures (9) (push) Has been cancelled
CI / Check generated parser (push) Has been cancelled
CI / golangci-lint (push) Has been cancelled
CI / fuzzing (push) Has been cancelled
CI / codeql (push) Has been cancelled
CI / Report status of build Prometheus for all architectures (push) Has been cancelled
CI / Publish main branch artifacts (push) Has been cancelled
CI / Publish release artefacts (push) Has been cancelled
CI / Publish UI on npm Registry (push) Has been cancelled
Signed-off-by: Julius Volz <julius.volz@gmail.com>
81 lines
2.6 KiB
TypeScript
81 lines
2.6 KiB
TypeScript
import { Table } from "@mantine/core";
|
|
import { useSuspenseAPIQuery } from "../api/api";
|
|
import { IconRun, IconWall } from "@tabler/icons-react";
|
|
import { formatTimestamp } from "../lib/formatTime";
|
|
import { useSettings } from "../state/settingsSlice";
|
|
import InfoPageCard from "../components/InfoPageCard";
|
|
import InfoPageStack from "../components/InfoPageStack";
|
|
|
|
export default function StatusPage() {
|
|
const { data: buildinfo } = useSuspenseAPIQuery<Record<string, string>>({
|
|
path: `/status/buildinfo`,
|
|
});
|
|
const { data: runtimeinfo } = useSuspenseAPIQuery<Record<string, string>>({
|
|
path: `/status/runtimeinfo`,
|
|
});
|
|
|
|
const { useLocalTime } = useSettings();
|
|
|
|
const statusConfig: Record<
|
|
string,
|
|
{
|
|
title?: string;
|
|
formatValue?: (v: string | boolean) => string;
|
|
}
|
|
> = {
|
|
startTime: {
|
|
title: "Start time",
|
|
formatValue: (v: string | boolean) =>
|
|
formatTimestamp(new Date(v as string).valueOf() / 1000, useLocalTime),
|
|
},
|
|
CWD: { title: "Working directory" },
|
|
reloadConfigSuccess: {
|
|
title: "Configuration reload",
|
|
formatValue: (v: string | boolean) => (v ? "Successful" : "Unsuccessful"),
|
|
},
|
|
lastConfigTime: {
|
|
title: "Last successful configuration reload",
|
|
formatValue: (v: string | boolean) =>
|
|
formatTimestamp(new Date(v as string).valueOf() / 1000, useLocalTime),
|
|
},
|
|
corruptionCount: { title: "WAL corruptions" },
|
|
goroutineCount: { title: "Goroutines" },
|
|
storageRetention: { title: "Storage retention" },
|
|
};
|
|
|
|
return (
|
|
<InfoPageStack>
|
|
<InfoPageCard title="Build information" icon={IconWall}>
|
|
<Table layout="fixed">
|
|
<Table.Tbody>
|
|
{Object.entries(buildinfo.data).map(([k, v]) => (
|
|
<Table.Tr key={k}>
|
|
<Table.Th style={{ textTransform: "capitalize" }}>{k}</Table.Th>
|
|
<Table.Td>{v}</Table.Td>
|
|
</Table.Tr>
|
|
))}
|
|
</Table.Tbody>
|
|
</Table>
|
|
</InfoPageCard>
|
|
<InfoPageCard title="Runtime information" icon={IconRun}>
|
|
<Table layout="fixed">
|
|
<Table.Tbody>
|
|
{Object.entries(runtimeinfo.data).map(([k, v]) => {
|
|
const { title = k, formatValue = (val: string) => val } =
|
|
statusConfig[k] || {};
|
|
return (
|
|
<Table.Tr key={k}>
|
|
<Table.Th style={{ textTransform: "capitalize" }}>
|
|
{title}
|
|
</Table.Th>
|
|
<Table.Td>{formatValue(v)}</Table.Td>
|
|
</Table.Tr>
|
|
);
|
|
})}
|
|
</Table.Tbody>
|
|
</Table>
|
|
</InfoPageCard>
|
|
</InfoPageStack>
|
|
);
|
|
}
|