mirror of https://github.com/prometheus/prometheus
Make status page timestamps consistent and use local time
Signed-off-by: Julius Volz <julius.volz@gmail.com>pull/14872/head
parent
a0463f5501
commit
ff41d45bae
|
@ -2,6 +2,17 @@ import { Card, Group, Stack, Table, Text } from "@mantine/core";
|
||||||
import { useSuspenseAPIQuery } from "../api/api";
|
import { useSuspenseAPIQuery } from "../api/api";
|
||||||
import { IconRun, IconWall } from "@tabler/icons-react";
|
import { IconRun, IconWall } from "@tabler/icons-react";
|
||||||
import { formatTimestamp } from "../lib/formatTime";
|
import { formatTimestamp } from "../lib/formatTime";
|
||||||
|
import { useSettings } from "../state/settingsSlice";
|
||||||
|
|
||||||
|
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<
|
const statusConfig: Record<
|
||||||
string,
|
string,
|
||||||
|
@ -13,7 +24,7 @@ const statusConfig: Record<
|
||||||
startTime: {
|
startTime: {
|
||||||
title: "Start time",
|
title: "Start time",
|
||||||
formatValue: (v: string | boolean) =>
|
formatValue: (v: string | boolean) =>
|
||||||
formatTimestamp(new Date(v as string).valueOf() / 1000, false), // TODO: Set useLocalTime parameter correctly.
|
formatTimestamp(new Date(v as string).valueOf() / 1000, useLocalTime),
|
||||||
},
|
},
|
||||||
CWD: { title: "Working directory" },
|
CWD: { title: "Working directory" },
|
||||||
reloadConfigSuccess: {
|
reloadConfigSuccess: {
|
||||||
|
@ -22,21 +33,14 @@ const statusConfig: Record<
|
||||||
},
|
},
|
||||||
lastConfigTime: {
|
lastConfigTime: {
|
||||||
title: "Last successful configuration reload",
|
title: "Last successful configuration reload",
|
||||||
formatValue: (v: string | boolean) => new Date(v as string).toUTCString(),
|
formatValue: (v: string | boolean) =>
|
||||||
|
formatTimestamp(new Date(v as string).valueOf() / 1000, useLocalTime),
|
||||||
},
|
},
|
||||||
corruptionCount: { title: "WAL corruptions" },
|
corruptionCount: { title: "WAL corruptions" },
|
||||||
goroutineCount: { title: "Goroutines" },
|
goroutineCount: { title: "Goroutines" },
|
||||||
storageRetention: { title: "Storage retention" },
|
storageRetention: { title: "Storage retention" },
|
||||||
};
|
};
|
||||||
|
|
||||||
export default function StatusPage() {
|
|
||||||
const { data: buildinfo } = useSuspenseAPIQuery<Record<string, string>>({
|
|
||||||
path: `/status/buildinfo`,
|
|
||||||
});
|
|
||||||
const { data: runtimeinfo } = useSuspenseAPIQuery<Record<string, string>>({
|
|
||||||
path: `/status/runtimeinfo`,
|
|
||||||
});
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Stack gap="lg" maw={1000} mx="auto" mt="xs">
|
<Stack gap="lg" maw={1000} mx="auto" mt="xs">
|
||||||
<Card shadow="xs" withBorder p="md">
|
<Card shadow="xs" withBorder p="md">
|
||||||
|
|
Loading…
Reference in New Issue