mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-11 05:35:25 +03:00
Add dialog for viewing and copying vainfo
This commit is contained in:
parent
4cee88b24b
commit
5d9c8decee
@ -59,7 +59,7 @@ class StatsEmitter(threading.Thread):
|
|||||||
selected = {}
|
selected = {}
|
||||||
|
|
||||||
for k in keys:
|
for k in keys:
|
||||||
selected[k] = s[k]
|
selected[k] = s.get(k)
|
||||||
|
|
||||||
selected_stats.append(selected)
|
selected_stats.append(selected)
|
||||||
|
|
||||||
@ -67,7 +67,7 @@ class StatsEmitter(threading.Thread):
|
|||||||
|
|
||||||
def run(self) -> None:
|
def run(self) -> None:
|
||||||
time.sleep(10)
|
time.sleep(10)
|
||||||
for counter in itertools.cycle(range(int(self.config.record.expire_interval / 10))):
|
for counter in itertools.cycle(range(int(self.config.mqtt.stats_interval / 10))):
|
||||||
if self.stop_event.wait(10):
|
if self.stop_event.wait(10):
|
||||||
break
|
break
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import { Threshold } from "@/types/graph";
|
import { Threshold } from "@/types/graph";
|
||||||
import { useMemo } from "react";
|
import { useCallback, useEffect, useMemo } from "react";
|
||||||
import Chart from "react-apexcharts";
|
import Chart from "react-apexcharts";
|
||||||
|
|
||||||
type SystemGraphProps = {
|
type SystemGraphProps = {
|
||||||
@ -7,6 +7,7 @@ type SystemGraphProps = {
|
|||||||
name: string;
|
name: string;
|
||||||
unit: string;
|
unit: string;
|
||||||
threshold: Threshold;
|
threshold: Threshold;
|
||||||
|
updateTimes: number[];
|
||||||
data: ApexAxisChartSeries;
|
data: ApexAxisChartSeries;
|
||||||
};
|
};
|
||||||
export default function SystemGraph({
|
export default function SystemGraph({
|
||||||
@ -14,6 +15,7 @@ export default function SystemGraph({
|
|||||||
name,
|
name,
|
||||||
unit,
|
unit,
|
||||||
threshold,
|
threshold,
|
||||||
|
updateTimes,
|
||||||
data,
|
data,
|
||||||
}: SystemGraphProps) {
|
}: SystemGraphProps) {
|
||||||
const lastValue = useMemo<number>(
|
const lastValue = useMemo<number>(
|
||||||
@ -22,18 +24,19 @@ export default function SystemGraph({
|
|||||||
[data],
|
[data],
|
||||||
);
|
);
|
||||||
|
|
||||||
return (
|
const formatTime = useCallback(
|
||||||
<div className="w-full flex flex-col">
|
(val: unknown) => {
|
||||||
<div className="flex items-center gap-1">
|
console.log(
|
||||||
<div className="text-xs text-muted-foreground">{name}</div>
|
`inside the check we have ${updateTimes.length} times and we are looking for ${val}`,
|
||||||
<div className="text-xs text-primary-foreground">
|
);
|
||||||
{lastValue}
|
const date = new Date(updateTimes[Math.round(val as number)] * 1000);
|
||||||
{unit}
|
return `${date.getHours() > 12 ? date.getHours() - 12 : date.getHours()}:${date.getMinutes()}`;
|
||||||
</div>
|
},
|
||||||
</div>
|
[updateTimes],
|
||||||
<Chart
|
);
|
||||||
type="bar"
|
|
||||||
options={{
|
const options = useMemo(() => {
|
||||||
|
return {
|
||||||
chart: {
|
chart: {
|
||||||
id: graphId,
|
id: graphId,
|
||||||
selection: {
|
selection: {
|
||||||
@ -66,27 +69,44 @@ export default function SystemGraph({
|
|||||||
dataLabels: {
|
dataLabels: {
|
||||||
enabled: false,
|
enabled: false,
|
||||||
},
|
},
|
||||||
|
plotOptions: {
|
||||||
|
bar: {
|
||||||
|
distributed: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
xaxis: {
|
xaxis: {
|
||||||
type: "datetime",
|
tickAmount: 6,
|
||||||
|
labels: {
|
||||||
|
formatter: formatTime,
|
||||||
|
},
|
||||||
axisBorder: {
|
axisBorder: {
|
||||||
show: false,
|
show: false,
|
||||||
},
|
},
|
||||||
axisTicks: {
|
axisTicks: {
|
||||||
show: false,
|
show: false,
|
||||||
},
|
},
|
||||||
labels: {
|
|
||||||
format: "h:mm",
|
|
||||||
datetimeUTC: false,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
yaxis: {
|
yaxis: {
|
||||||
show: false,
|
show: false,
|
||||||
max: lastValue * 2,
|
max: lastValue * 2,
|
||||||
},
|
},
|
||||||
}}
|
};
|
||||||
series={data}
|
}, [graphId, lastValue, threshold, formatTime]);
|
||||||
height="120"
|
|
||||||
/>
|
useEffect(() => {
|
||||||
|
ApexCharts.exec(graphId, "updateOptions", options, true, true);
|
||||||
|
}, [graphId, options]);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="w-full flex flex-col">
|
||||||
|
<div className="flex items-center gap-1">
|
||||||
|
<div className="text-xs text-muted-foreground">{name}</div>
|
||||||
|
<div className="text-xs text-primary-foreground">
|
||||||
|
{lastValue}
|
||||||
|
{unit}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<Chart type="bar" options={options} series={data} height="120" />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
57
web/src/components/overlay/VainfoDialog.tsx
Normal file
57
web/src/components/overlay/VainfoDialog.tsx
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
import useSWR from "swr";
|
||||||
|
import {
|
||||||
|
Dialog,
|
||||||
|
DialogContent,
|
||||||
|
DialogFooter,
|
||||||
|
DialogHeader,
|
||||||
|
DialogTitle,
|
||||||
|
} from "../ui/dialog";
|
||||||
|
import ActivityIndicator from "../indicators/activity-indicator";
|
||||||
|
import { Vainfo } from "@/types/stats";
|
||||||
|
import { Button } from "../ui/button";
|
||||||
|
import copy from "copy-to-clipboard";
|
||||||
|
|
||||||
|
type VainfoDialogProps = {
|
||||||
|
showVainfo: boolean;
|
||||||
|
setShowVainfo: (show: boolean) => void;
|
||||||
|
};
|
||||||
|
export default function VainfoDialog({
|
||||||
|
showVainfo,
|
||||||
|
setShowVainfo,
|
||||||
|
}: VainfoDialogProps) {
|
||||||
|
const { data: vainfo } = useSWR<Vainfo>(showVainfo ? "vainfo" : null);
|
||||||
|
|
||||||
|
const onCopyVainfo = async () => {
|
||||||
|
copy(JSON.stringify(vainfo).replace(/[\\\s]+/gi, ""));
|
||||||
|
setShowVainfo(false);
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Dialog open={showVainfo} onOpenChange={setShowVainfo}>
|
||||||
|
<DialogContent>
|
||||||
|
<DialogHeader>
|
||||||
|
<DialogTitle>Vainfo Output</DialogTitle>
|
||||||
|
</DialogHeader>
|
||||||
|
{vainfo ? (
|
||||||
|
<div className="mb-2 max-h-96 whitespace-pre-line overflow-y-scroll">
|
||||||
|
<div>Return Code: {vainfo.return_code}</div>
|
||||||
|
<br />
|
||||||
|
<div>Process {vainfo.return_code == 0 ? "Output" : "Error"}:</div>
|
||||||
|
<br />
|
||||||
|
<div>{vainfo.return_code == 0 ? vainfo.stdout : vainfo.stderr}</div>
|
||||||
|
</div>
|
||||||
|
) : (
|
||||||
|
<ActivityIndicator />
|
||||||
|
)}
|
||||||
|
<DialogFooter>
|
||||||
|
<Button variant="secondary" onClick={() => setShowVainfo(false)}>
|
||||||
|
Close
|
||||||
|
</Button>
|
||||||
|
<Button variant="select" onClick={() => onCopyVainfo()}>
|
||||||
|
Copy
|
||||||
|
</Button>
|
||||||
|
</DialogFooter>
|
||||||
|
</DialogContent>
|
||||||
|
</Dialog>
|
||||||
|
);
|
||||||
|
}
|
||||||
@ -8,263 +8,31 @@ import { FrigateConfig } from "@/types/frigateConfig";
|
|||||||
import {
|
import {
|
||||||
DetectorCpuThreshold,
|
DetectorCpuThreshold,
|
||||||
DetectorMemThreshold,
|
DetectorMemThreshold,
|
||||||
|
GPUMemThreshold,
|
||||||
|
GPUUsageThreshold,
|
||||||
InferenceThreshold,
|
InferenceThreshold,
|
||||||
} from "@/types/graph";
|
} from "@/types/graph";
|
||||||
import { ToggleGroup, ToggleGroupItem } from "@/components/ui/toggle-group";
|
import { ToggleGroup, ToggleGroupItem } from "@/components/ui/toggle-group";
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
|
import VainfoDialog from "@/components/overlay/VainfoDialog";
|
||||||
|
|
||||||
const metrics = ["general", "storage", "cameras"] as const;
|
const metrics = ["general", "storage", "cameras"] as const;
|
||||||
type SystemMetric = (typeof metrics)[number];
|
type SystemMetric = (typeof metrics)[number];
|
||||||
|
|
||||||
function System() {
|
function System() {
|
||||||
const { data: config } = useSWR<FrigateConfig>("config");
|
|
||||||
|
|
||||||
// stats page
|
// stats page
|
||||||
|
|
||||||
const [page, setPage] = useState<SystemMetric>("general");
|
const [page, setPage] = useState<SystemMetric>("general");
|
||||||
|
const [lastUpdated, setLastUpdated] = useState<number>(Date.now() / 1000);
|
||||||
|
|
||||||
// stats collection
|
// stats collection
|
||||||
|
|
||||||
const { data: initialStats } = useSWR<FrigateStats[]>("stats/history", {
|
const { data: statsSnapshot } = useSWR<FrigateStats>("stats", {
|
||||||
revalidateOnFocus: false,
|
revalidateOnFocus: false,
|
||||||
});
|
});
|
||||||
const { payload: updatedStats } = useFrigateStats();
|
|
||||||
const [statsHistory, setStatsHistory] = useState<FrigateStats[]>(
|
|
||||||
initialStats || [],
|
|
||||||
);
|
|
||||||
|
|
||||||
const lastUpdated = useMemo(() => {
|
|
||||||
if (updatedStats) {
|
|
||||||
return updatedStats.service.last_updated;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (initialStats) {
|
|
||||||
return initialStats.at(-1)?.service?.last_updated;
|
|
||||||
}
|
|
||||||
|
|
||||||
return undefined;
|
|
||||||
}, [initialStats, updatedStats]);
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (initialStats == undefined) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (statsHistory.length < initialStats.length) {
|
|
||||||
setStatsHistory(initialStats);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
setStatsHistory([...statsHistory, updatedStats]);
|
|
||||||
}, [initialStats, updatedStats]);
|
|
||||||
|
|
||||||
// stats data pieces
|
|
||||||
|
|
||||||
const gpuSeries = useMemo(() => {
|
|
||||||
if (!statsHistory) {
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
|
|
||||||
const series: {
|
|
||||||
[key: string]: { name: string; data: { x: object; y: string }[] };
|
|
||||||
} = {};
|
|
||||||
|
|
||||||
statsHistory.forEach((stats) => {
|
|
||||||
if (!stats) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const statTime = new Date(stats.service.last_updated * 1000);
|
|
||||||
|
|
||||||
Object.entries(stats.gpu_usages || []).forEach(([key, stats]) => {
|
|
||||||
if (!(key in series)) {
|
|
||||||
series[key] = { name: key, data: [] };
|
|
||||||
}
|
|
||||||
|
|
||||||
series[key].data.push({ x: statTime, y: stats.gpu });
|
|
||||||
});
|
|
||||||
});
|
|
||||||
return Object.keys(series).length > 0 ? Object.values(series) : [];
|
|
||||||
}, [statsHistory]);
|
|
||||||
const gpuMemSeries = useMemo(() => {
|
|
||||||
if (!statsHistory) {
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
|
|
||||||
const series: {
|
|
||||||
[key: string]: { name: string; data: { x: object; y: string }[] };
|
|
||||||
} = {};
|
|
||||||
|
|
||||||
statsHistory.forEach((stats) => {
|
|
||||||
if (!stats) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const statTime = new Date(stats.service.last_updated * 1000);
|
|
||||||
|
|
||||||
Object.entries(stats.gpu_usages || {}).forEach(([key, stats]) => {
|
|
||||||
if (!(key in series)) {
|
|
||||||
series[key] = { name: key, data: [] };
|
|
||||||
}
|
|
||||||
|
|
||||||
series[key].data.push({ x: statTime, y: stats.mem });
|
|
||||||
});
|
|
||||||
});
|
|
||||||
return Object.values(series);
|
|
||||||
}, [statsHistory]);
|
|
||||||
const cameraCpuSeries = useMemo(() => {
|
|
||||||
if (!statsHistory || statsHistory.length == 0) {
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
|
|
||||||
const series: {
|
|
||||||
[cam: string]: {
|
|
||||||
[key: string]: { name: string; data: { x: object; y: string }[] };
|
|
||||||
};
|
|
||||||
} = {};
|
|
||||||
|
|
||||||
statsHistory.forEach((stats) => {
|
|
||||||
if (!stats) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const statTime = new Date(stats.service.last_updated * 1000);
|
|
||||||
|
|
||||||
Object.entries(stats.cameras).forEach(([key, camStats]) => {
|
|
||||||
if (!config?.cameras[key].enabled) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!(key in series)) {
|
|
||||||
const camName = key.replaceAll("_", " ");
|
|
||||||
series[key] = {};
|
|
||||||
series[key]["ffmpeg"] = { name: `${camName} ffmpeg`, data: [] };
|
|
||||||
series[key]["capture"] = { name: `${camName} capture`, data: [] };
|
|
||||||
series[key]["detect"] = { name: `${camName} detect`, data: [] };
|
|
||||||
}
|
|
||||||
|
|
||||||
series[key]["ffmpeg"].data.push({
|
|
||||||
x: statTime,
|
|
||||||
y: stats.cpu_usages[camStats.ffmpeg_pid.toString()]?.cpu ?? 0.0,
|
|
||||||
});
|
|
||||||
series[key]["capture"].data.push({
|
|
||||||
x: statTime,
|
|
||||||
y: stats.cpu_usages[camStats.capture_pid?.toString()]?.cpu ?? 0,
|
|
||||||
});
|
|
||||||
series[key]["detect"].data.push({
|
|
||||||
x: statTime,
|
|
||||||
y: stats.cpu_usages[camStats.pid.toString()].cpu,
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
return series;
|
|
||||||
}, [statsHistory]);
|
|
||||||
const cameraFpsSeries = useMemo(() => {
|
|
||||||
if (!statsHistory) {
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
|
|
||||||
const series: {
|
|
||||||
[cam: string]: {
|
|
||||||
[key: string]: { name: string; data: { x: object; y: number }[] };
|
|
||||||
};
|
|
||||||
} = {};
|
|
||||||
|
|
||||||
statsHistory.forEach((stats) => {
|
|
||||||
if (!stats) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const statTime = new Date(stats.service.last_updated * 1000);
|
|
||||||
|
|
||||||
Object.entries(stats.cameras).forEach(([key, camStats]) => {
|
|
||||||
if (!(key in series)) {
|
|
||||||
const camName = key.replaceAll("_", " ");
|
|
||||||
series[key] = {};
|
|
||||||
series[key]["det"] = { name: `${camName} detections`, data: [] };
|
|
||||||
series[key]["skip"] = {
|
|
||||||
name: `${camName} skipped detections`,
|
|
||||||
data: [],
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
series[key]["det"].data.push({
|
|
||||||
x: statTime,
|
|
||||||
y: camStats.detection_fps,
|
|
||||||
});
|
|
||||||
series[key]["skip"].data.push({
|
|
||||||
x: statTime,
|
|
||||||
y: camStats.skipped_fps,
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
return series;
|
|
||||||
}, [statsHistory]);
|
|
||||||
const otherProcessCpuSeries = useMemo(() => {
|
|
||||||
if (!statsHistory) {
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
|
|
||||||
const series: {
|
|
||||||
[key: string]: { name: string; data: { x: object; y: string }[] };
|
|
||||||
} = {};
|
|
||||||
|
|
||||||
statsHistory.forEach((stats) => {
|
|
||||||
if (!stats) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const statTime = new Date(stats.service.last_updated * 1000);
|
|
||||||
|
|
||||||
Object.entries(stats.processes).forEach(([key, procStats]) => {
|
|
||||||
if (procStats.pid.toString() in stats.cpu_usages) {
|
|
||||||
if (!(key in series)) {
|
|
||||||
series[key] = { name: `${key} (${procStats.pid})`, data: [] };
|
|
||||||
}
|
|
||||||
|
|
||||||
series[key].data.push({
|
|
||||||
x: statTime,
|
|
||||||
y: stats.cpu_usages[procStats.pid.toString()].cpu,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
return Object.keys(series).length > 0 ? Object.values(series) : [];
|
|
||||||
}, [statsHistory]);
|
|
||||||
const otherProcessMemSeries = useMemo(() => {
|
|
||||||
if (!statsHistory) {
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
|
|
||||||
const series: {
|
|
||||||
[key: string]: { name: string; data: { x: object; y: string }[] };
|
|
||||||
} = {};
|
|
||||||
|
|
||||||
statsHistory.forEach((stats) => {
|
|
||||||
if (!stats) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const statTime = new Date(stats.service.last_updated * 1000);
|
|
||||||
|
|
||||||
Object.entries(stats.processes).forEach(([key, procStats]) => {
|
|
||||||
if (procStats.pid.toString() in stats.cpu_usages) {
|
|
||||||
if (!(key in series)) {
|
|
||||||
series[key] = { name: key, data: [] };
|
|
||||||
}
|
|
||||||
|
|
||||||
series[key].data.push({
|
|
||||||
x: statTime,
|
|
||||||
y: stats.cpu_usages[procStats.pid.toString()].mem,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
return Object.values(series);
|
|
||||||
}, [statsHistory]);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="size-full p-2">
|
<div className="size-full p-2 flex flex-col">
|
||||||
<div className="w-full h-8 flex justify-between items-center">
|
<div className="w-full h-8 flex justify-between items-center">
|
||||||
<ToggleGroup
|
<ToggleGroup
|
||||||
className="*:px-3 *:py-4 *:rounded-2xl"
|
className="*:px-3 *:py-4 *:rounded-2xl"
|
||||||
@ -299,13 +67,18 @@ function System() {
|
|||||||
</div>
|
</div>
|
||||||
<div className="mt-2 flex items-end gap-2">
|
<div className="mt-2 flex items-end gap-2">
|
||||||
<div className="h-full font-medium content-center">System</div>
|
<div className="h-full font-medium content-center">System</div>
|
||||||
{initialStats && (
|
{statsSnapshot && (
|
||||||
<div className="h-full text-muted-foreground text-sm content-center">
|
<div className="h-full text-muted-foreground text-sm content-center">
|
||||||
{initialStats[0].service.version}
|
{statsSnapshot.service.version}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
{page == "general" && <GeneralMetrics />}
|
{page == "general" && (
|
||||||
|
<GeneralMetrics
|
||||||
|
lastUpdated={lastUpdated}
|
||||||
|
setLastUpdated={setLastUpdated}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -313,59 +86,96 @@ function System() {
|
|||||||
export default System;
|
export default System;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <div className="bg-primary rounded-2xl flex-col">
|
* const cameraCpuSeries = useMemo(() => {
|
||||||
|
if (!statsHistory || statsHistory.length == 0) {
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
</div>
|
const series: {
|
||||||
<div className="bg-primary rounded-2xl flex-col">
|
[cam: string]: {
|
||||||
<SystemGraph
|
[key: string]: { name: string; data: { x: object; y: string }[] };
|
||||||
graphId="detector-usages"
|
};
|
||||||
unit="%"
|
} = {};
|
||||||
name={""}
|
|
||||||
threshold={InferenceThreshold}
|
statsHistory.forEach((stats, statsIdx) => {
|
||||||
data={detMemSeries}
|
if (!stats) {
|
||||||
/>
|
return;
|
||||||
</div>
|
}
|
||||||
|
|
||||||
|
const statTime = new Date(stats.service.last_updated * 1000);
|
||||||
|
|
||||||
|
Object.entries(stats.cameras).forEach(([key, camStats]) => {
|
||||||
|
if (!config?.cameras[key].enabled) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(key in series)) {
|
||||||
|
const camName = key.replaceAll("_", " ");
|
||||||
|
series[key] = {};
|
||||||
|
series[key]["ffmpeg"] = { name: `${camName} ffmpeg`, data: [] };
|
||||||
|
series[key]["capture"] = { name: `${camName} capture`, data: [] };
|
||||||
|
series[key]["detect"] = { name: `${camName} detect`, data: [] };
|
||||||
|
}
|
||||||
|
|
||||||
|
series[key]["ffmpeg"].data.push({
|
||||||
|
x: statsIdx,
|
||||||
|
y: stats.cpu_usages[camStats.ffmpeg_pid.toString()]?.cpu ?? 0.0,
|
||||||
|
});
|
||||||
|
series[key]["capture"].data.push({
|
||||||
|
x: statsIdx,
|
||||||
|
y: stats.cpu_usages[camStats.capture_pid?.toString()]?.cpu ?? 0,
|
||||||
|
});
|
||||||
|
series[key]["detect"].data.push({
|
||||||
|
x: statsIdx,
|
||||||
|
y: stats.cpu_usages[camStats.pid.toString()].cpu,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
return series;
|
||||||
|
}, [statsHistory]);
|
||||||
|
const cameraFpsSeries = useMemo(() => {
|
||||||
|
if (!statsHistory) {
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
const series: {
|
||||||
|
[cam: string]: {
|
||||||
|
[key: string]: { name: string; data: { x: object; y: number }[] };
|
||||||
|
};
|
||||||
|
} = {};
|
||||||
|
|
||||||
|
statsHistory.forEach((stats, statsIdx) => {
|
||||||
|
if (!stats) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const statTime = new Date(stats.service.last_updated * 1000);
|
||||||
|
|
||||||
|
Object.entries(stats.cameras).forEach(([key, camStats]) => {
|
||||||
|
if (!(key in series)) {
|
||||||
|
const camName = key.replaceAll("_", " ");
|
||||||
|
series[key] = {};
|
||||||
|
series[key]["det"] = { name: `${camName} detections`, data: [] };
|
||||||
|
series[key]["skip"] = {
|
||||||
|
name: `${camName} skipped detections`,
|
||||||
|
data: [],
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
series[key]["det"].data.push({
|
||||||
|
x: statsIdx,
|
||||||
|
y: camStats.detection_fps,
|
||||||
|
});
|
||||||
|
series[key]["skip"].data.push({
|
||||||
|
x: statsIdx,
|
||||||
|
y: camStats.skipped_fps,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
return series;
|
||||||
|
}, [statsHistory]);
|
||||||
*
|
*
|
||||||
* <Heading as="h4">Detectors</Heading>
|
* <div className="bg-primary rounded-2xl flex-col">
|
||||||
<div className="grid grid-cols-1 sm:grid-cols-3">
|
|
||||||
<SystemGraph
|
|
||||||
graphId="detector-inference"
|
|
||||||
title="Inference Speed"
|
|
||||||
unit="ms"
|
|
||||||
data={detInferenceTimeSeries}
|
|
||||||
/>
|
|
||||||
<SystemGraph
|
|
||||||
graphId="detector-usages"
|
|
||||||
title="CPU"
|
|
||||||
unit="%"
|
|
||||||
data={detCpuSeries}
|
|
||||||
/>
|
|
||||||
<SystemGraph
|
|
||||||
graphId="detector-usages"
|
|
||||||
title="Memory"
|
|
||||||
unit="%"
|
|
||||||
data={detMemSeries}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
{gpuSeries.length > 0 && (
|
|
||||||
<>
|
|
||||||
<Heading as="h4">GPUs</Heading>
|
|
||||||
<div className="mt-2 grid grid-cols-1 sm:grid-cols-2">
|
|
||||||
<SystemGraph
|
|
||||||
graphId="detector-inference"
|
|
||||||
title="GPU Usage"
|
|
||||||
unit="%"
|
|
||||||
data={gpuSeries}
|
|
||||||
/>
|
|
||||||
<SystemGraph
|
|
||||||
graphId="detector-usages"
|
|
||||||
title="GPU Memory"
|
|
||||||
unit="%"
|
|
||||||
data={gpuMemSeries}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</>
|
|
||||||
)}
|
|
||||||
<Heading as="h4">Cameras</Heading>
|
<Heading as="h4">Cameras</Heading>
|
||||||
<div className="grid grid-cols-1 sm:grid-cols-2">
|
<div className="grid grid-cols-1 sm:grid-cols-2">
|
||||||
{config &&
|
{config &&
|
||||||
@ -392,28 +202,21 @@ export default System;
|
|||||||
return null;
|
return null;
|
||||||
})}
|
})}
|
||||||
</div>
|
</div>
|
||||||
<Heading as="h4">Other Processes</Heading>
|
|
||||||
<div className="grid grid-cols-1 sm:grid-cols-2">
|
|
||||||
<SystemGraph
|
|
||||||
graphId="process-cpu"
|
|
||||||
title="CPU"
|
|
||||||
unit="%"
|
|
||||||
data={otherProcessCpuSeries}
|
|
||||||
/>
|
|
||||||
<SystemGraph
|
|
||||||
graphId="process-mem"
|
|
||||||
title="Memory"
|
|
||||||
unit="%"
|
|
||||||
data={otherProcessMemSeries}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function GeneralMetrics() {
|
type GeneralMetricsProps = {
|
||||||
|
lastUpdated: number;
|
||||||
|
setLastUpdated: (last: number) => void;
|
||||||
|
};
|
||||||
|
function GeneralMetrics({ lastUpdated, setLastUpdated }: GeneralMetricsProps) {
|
||||||
|
// extra info
|
||||||
|
|
||||||
|
const [showVainfo, setShowVainfo] = useState(false);
|
||||||
|
|
||||||
// stats
|
// stats
|
||||||
|
|
||||||
const { data: initialStats } = useSWR<FrigateStats[]>(
|
const { data: initialStats } = useSWR<FrigateStats[]>(
|
||||||
["stats/history", { keys: "cpu_usages,detectors,service" }],
|
["stats/history", { keys: "cpu_usages,detectors,processes,service" }],
|
||||||
{
|
{
|
||||||
revalidateOnFocus: false,
|
revalidateOnFocus: false,
|
||||||
},
|
},
|
||||||
@ -423,19 +226,33 @@ function GeneralMetrics() {
|
|||||||
const { payload: updatedStats } = useFrigateStats();
|
const { payload: updatedStats } = useFrigateStats();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (initialStats == undefined) {
|
if (initialStats == undefined || initialStats.length == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (statsHistory.length < initialStats.length) {
|
if (statsHistory.length == 0) {
|
||||||
setStatsHistory(initialStats);
|
setStatsHistory(initialStats);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
setStatsHistory([...statsHistory, updatedStats]);
|
if (!updatedStats) {
|
||||||
}, [initialStats, updatedStats]);
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// stats data pieces
|
if (updatedStats.service.last_updated > lastUpdated) {
|
||||||
|
setStatsHistory([...statsHistory, updatedStats]);
|
||||||
|
setLastUpdated(Date.now() / 1000);
|
||||||
|
}
|
||||||
|
}, [initialStats, updatedStats, statsHistory, lastUpdated, setLastUpdated]);
|
||||||
|
|
||||||
|
// timestamps
|
||||||
|
|
||||||
|
const updateTimes = useMemo(
|
||||||
|
() => statsHistory.map((stats) => stats.service.last_updated),
|
||||||
|
[statsHistory],
|
||||||
|
);
|
||||||
|
|
||||||
|
// detectors stats
|
||||||
|
|
||||||
const detInferenceTimeSeries = useMemo(() => {
|
const detInferenceTimeSeries = useMemo(() => {
|
||||||
if (!statsHistory) {
|
if (!statsHistory) {
|
||||||
@ -443,78 +260,74 @@ function GeneralMetrics() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const series: {
|
const series: {
|
||||||
[key: string]: { name: string; data: { x: object; y: number }[] };
|
[key: string]: { name: string; data: { x: number; y: number }[] };
|
||||||
} = {};
|
} = {};
|
||||||
|
|
||||||
statsHistory.forEach((stats) => {
|
statsHistory.forEach((stats, statsIdx) => {
|
||||||
if (!stats) {
|
if (!stats) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const statTime = new Date(stats.service.last_updated * 1000);
|
|
||||||
|
|
||||||
Object.entries(stats.detectors).forEach(([key, stats]) => {
|
Object.entries(stats.detectors).forEach(([key, stats]) => {
|
||||||
if (!(key in series)) {
|
if (!(key in series)) {
|
||||||
series[key] = { name: `${key} (${stats.pid})`, data: [] };
|
series[key] = { name: key, data: [] };
|
||||||
}
|
}
|
||||||
|
|
||||||
series[key].data.push({ x: statTime, y: stats.inference_speed });
|
series[key].data.push({ x: statsIdx, y: stats.inference_speed });
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
return Object.values(series);
|
return Object.values(series);
|
||||||
}, [statsHistory]);
|
}, [statsHistory]);
|
||||||
|
|
||||||
const detCpuSeries = useMemo(() => {
|
const detCpuSeries = useMemo(() => {
|
||||||
if (!statsHistory) {
|
if (!statsHistory) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
const series: {
|
const series: {
|
||||||
[key: string]: { name: string; data: { x: object; y: string }[] };
|
[key: string]: { name: string; data: { x: number; y: string }[] };
|
||||||
} = {};
|
} = {};
|
||||||
|
|
||||||
statsHistory.forEach((stats) => {
|
statsHistory.forEach((stats, statsIdx) => {
|
||||||
if (!stats) {
|
if (!stats) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const statTime = new Date(stats.service.last_updated * 1000);
|
|
||||||
|
|
||||||
Object.entries(stats.detectors).forEach(([key, detStats]) => {
|
Object.entries(stats.detectors).forEach(([key, detStats]) => {
|
||||||
if (!(key in series)) {
|
if (!(key in series)) {
|
||||||
series[key] = { name: key, data: [] };
|
series[key] = { name: key, data: [] };
|
||||||
}
|
}
|
||||||
|
|
||||||
series[key].data.push({
|
series[key].data.push({
|
||||||
x: statTime,
|
x: statsIdx,
|
||||||
y: stats.cpu_usages[detStats.pid.toString()].cpu,
|
y: stats.cpu_usages[detStats.pid.toString()].cpu,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
return Object.values(series);
|
return Object.values(series);
|
||||||
}, [statsHistory]);
|
}, [statsHistory]);
|
||||||
|
|
||||||
const detMemSeries = useMemo(() => {
|
const detMemSeries = useMemo(() => {
|
||||||
if (!statsHistory) {
|
if (!statsHistory) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
const series: {
|
const series: {
|
||||||
[key: string]: { name: string; data: { x: object; y: string }[] };
|
[key: string]: { name: string; data: { x: number; y: string }[] };
|
||||||
} = {};
|
} = {};
|
||||||
|
|
||||||
statsHistory.forEach((stats) => {
|
statsHistory.forEach((stats, statsIdx) => {
|
||||||
if (!stats) {
|
if (!stats) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const statTime = new Date(stats.service.last_updated * 1000);
|
|
||||||
|
|
||||||
Object.entries(stats.detectors).forEach(([key, detStats]) => {
|
Object.entries(stats.detectors).forEach(([key, detStats]) => {
|
||||||
if (!(key in series)) {
|
if (!(key in series)) {
|
||||||
series[key] = { name: key, data: [] };
|
series[key] = { name: key, data: [] };
|
||||||
}
|
}
|
||||||
|
|
||||||
series[key].data.push({
|
series[key].data.push({
|
||||||
x: statTime,
|
x: statsIdx,
|
||||||
y: stats.cpu_usages[detStats.pid.toString()].mem,
|
y: stats.cpu_usages[detStats.pid.toString()].mem,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -522,19 +335,143 @@ function GeneralMetrics() {
|
|||||||
return Object.values(series);
|
return Object.values(series);
|
||||||
}, [statsHistory]);
|
}, [statsHistory]);
|
||||||
|
|
||||||
|
// gpu stats
|
||||||
|
|
||||||
|
const gpuSeries = useMemo(() => {
|
||||||
|
if (!statsHistory) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
const series: {
|
||||||
|
[key: string]: { name: string; data: { x: number; y: string }[] };
|
||||||
|
} = {};
|
||||||
|
|
||||||
|
statsHistory.forEach((stats, statsIdx) => {
|
||||||
|
if (!stats) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Object.entries(stats.gpu_usages || []).forEach(([key, stats]) => {
|
||||||
|
if (!(key in series)) {
|
||||||
|
series[key] = { name: key, data: [] };
|
||||||
|
}
|
||||||
|
|
||||||
|
series[key].data.push({ x: statsIdx, y: stats.gpu });
|
||||||
|
});
|
||||||
|
});
|
||||||
|
return Object.keys(series).length > 0 ? Object.values(series) : [];
|
||||||
|
}, [statsHistory]);
|
||||||
|
|
||||||
|
const gpuMemSeries = useMemo(() => {
|
||||||
|
if (!statsHistory) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
const series: {
|
||||||
|
[key: string]: { name: string; data: { x: number; y: string }[] };
|
||||||
|
} = {};
|
||||||
|
|
||||||
|
statsHistory.forEach((stats, statsIdx) => {
|
||||||
|
if (!stats) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Object.entries(stats.gpu_usages || {}).forEach(([key, stats]) => {
|
||||||
|
if (!(key in series)) {
|
||||||
|
series[key] = { name: key, data: [] };
|
||||||
|
}
|
||||||
|
|
||||||
|
series[key].data.push({ x: statsIdx, y: stats.mem });
|
||||||
|
});
|
||||||
|
});
|
||||||
|
return Object.values(series);
|
||||||
|
}, [statsHistory]);
|
||||||
|
|
||||||
|
// other processes stats
|
||||||
|
|
||||||
|
const otherProcessCpuSeries = useMemo(() => {
|
||||||
|
if (!statsHistory) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
const series: {
|
||||||
|
[key: string]: { name: string; data: { x: number; y: string }[] };
|
||||||
|
} = {};
|
||||||
|
|
||||||
|
statsHistory.forEach((stats, statsIdx) => {
|
||||||
|
if (!stats) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Object.entries(stats.processes).forEach(([key, procStats]) => {
|
||||||
|
if (procStats.pid.toString() in stats.cpu_usages) {
|
||||||
|
if (!(key in series)) {
|
||||||
|
series[key] = { name: key, data: [] };
|
||||||
|
}
|
||||||
|
|
||||||
|
series[key].data.push({
|
||||||
|
x: statsIdx,
|
||||||
|
y: stats.cpu_usages[procStats.pid.toString()].cpu,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
return Object.keys(series).length > 0 ? Object.values(series) : [];
|
||||||
|
}, [statsHistory]);
|
||||||
|
|
||||||
|
const otherProcessMemSeries = useMemo(() => {
|
||||||
|
if (!statsHistory) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
const series: {
|
||||||
|
[key: string]: { name: string; data: { x: number; y: string }[] };
|
||||||
|
} = {};
|
||||||
|
|
||||||
|
statsHistory.forEach((stats, statsIdx) => {
|
||||||
|
if (!stats) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Object.entries(stats.processes).forEach(([key, procStats]) => {
|
||||||
|
if (procStats.pid.toString() in stats.cpu_usages) {
|
||||||
|
if (!(key in series)) {
|
||||||
|
series[key] = { name: key, data: [] };
|
||||||
|
}
|
||||||
|
|
||||||
|
series[key].data.push({
|
||||||
|
x: statsIdx,
|
||||||
|
y: stats.cpu_usages[procStats.pid.toString()].mem,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
return Object.values(series);
|
||||||
|
}, [statsHistory]);
|
||||||
|
|
||||||
|
if (statsHistory.length == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="size-full mt-4 flex flex-col">
|
<>
|
||||||
<div className="text-muted-foreground text-sm font-medium">Detectors</div>
|
<VainfoDialog showVainfo={showVainfo} setShowVainfo={setShowVainfo} />
|
||||||
|
|
||||||
|
<div className="size-full mt-4 flex flex-col overflow-y-auto">
|
||||||
|
<div className="text-muted-foreground text-sm font-medium">
|
||||||
|
Detectors
|
||||||
|
</div>
|
||||||
<div className="mt-4 grid grid-cols-1 sm:grid-cols-3 gap-2">
|
<div className="mt-4 grid grid-cols-1 sm:grid-cols-3 gap-2">
|
||||||
<div className="p-2.5 bg-primary rounded-2xl flex-col">
|
<div className="p-2.5 bg-primary rounded-2xl flex-col">
|
||||||
<div className="mb-5">Detector Inference Speed</div>
|
<div className="mb-5">Detector Inference Speed</div>
|
||||||
{detInferenceTimeSeries.map((series) => (
|
{detInferenceTimeSeries.map((series) => (
|
||||||
<SystemGraph
|
<SystemGraph
|
||||||
key={series.name}
|
key={series.name}
|
||||||
graphId="detector-inference"
|
graphId={`${series.name}-inference`}
|
||||||
name={series.name}
|
name={series.name}
|
||||||
unit="ms"
|
unit="ms"
|
||||||
threshold={InferenceThreshold}
|
threshold={InferenceThreshold}
|
||||||
|
updateTimes={updateTimes}
|
||||||
data={[series]}
|
data={[series]}
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
@ -544,10 +481,11 @@ function GeneralMetrics() {
|
|||||||
{detCpuSeries.map((series) => (
|
{detCpuSeries.map((series) => (
|
||||||
<SystemGraph
|
<SystemGraph
|
||||||
key={series.name}
|
key={series.name}
|
||||||
graphId="detector-cpu-usages"
|
graphId={`${series.name}-cpu`}
|
||||||
unit="%"
|
unit="%"
|
||||||
name={series.name}
|
name={series.name}
|
||||||
threshold={DetectorCpuThreshold}
|
threshold={DetectorCpuThreshold}
|
||||||
|
updateTimes={updateTimes}
|
||||||
data={[series]}
|
data={[series]}
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
@ -557,10 +495,11 @@ function GeneralMetrics() {
|
|||||||
{detMemSeries.map((series) => (
|
{detMemSeries.map((series) => (
|
||||||
<SystemGraph
|
<SystemGraph
|
||||||
key={series.name}
|
key={series.name}
|
||||||
graphId="detector-mem-usages"
|
graphId={`${series.name}-mem`}
|
||||||
unit="%"
|
unit="%"
|
||||||
name={series.name}
|
name={series.name}
|
||||||
threshold={DetectorMemThreshold}
|
threshold={DetectorMemThreshold}
|
||||||
|
updateTimes={updateTimes}
|
||||||
data={[series]}
|
data={[series]}
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
@ -569,7 +508,7 @@ function GeneralMetrics() {
|
|||||||
|
|
||||||
{statsHistory.length > 0 && statsHistory[0].gpu_usages && (
|
{statsHistory.length > 0 && statsHistory[0].gpu_usages && (
|
||||||
<>
|
<>
|
||||||
<div className="flex items-center justify-between">
|
<div className="mt-4 flex items-center justify-between">
|
||||||
<div className="text-muted-foreground text-sm font-medium">
|
<div className="text-muted-foreground text-sm font-medium">
|
||||||
Detectors
|
Detectors
|
||||||
</div>
|
</div>
|
||||||
@ -578,45 +517,42 @@ function GeneralMetrics() {
|
|||||||
key == "amd-vaapi" ||
|
key == "amd-vaapi" ||
|
||||||
key == "intel-vaapi" ||
|
key == "intel-vaapi" ||
|
||||||
key == "intel-qsv",
|
key == "intel-qsv",
|
||||||
).length > 0 && <Button>Hardware Info</Button>}
|
).length > 0 && (
|
||||||
|
<Button
|
||||||
|
className="cursor-pointer"
|
||||||
|
variant="secondary"
|
||||||
|
size="sm"
|
||||||
|
onClick={() => setShowVainfo(true)}
|
||||||
|
>
|
||||||
|
Hardware Info
|
||||||
|
</Button>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
<div className="mt-4 grid grid-cols-1 sm:grid-cols-3 gap-2">
|
<div className=" mt-4 grid grid-cols-1 sm:grid-cols-2 gap-2">
|
||||||
<div className="p-2.5 bg-primary rounded-2xl flex-col">
|
<div className="p-2.5 bg-primary rounded-2xl flex-col">
|
||||||
<div className="mb-5">Detector Inference Speed</div>
|
<div className="mb-5">GPU Usage</div>
|
||||||
{detInferenceTimeSeries.map((series) => (
|
{gpuSeries.map((series) => (
|
||||||
<SystemGraph
|
<SystemGraph
|
||||||
key={series.name}
|
key={series.name}
|
||||||
graphId="detector-inference"
|
graphId={`${series.name}-gpu`}
|
||||||
name={series.name}
|
name={series.name}
|
||||||
unit="ms"
|
unit=""
|
||||||
threshold={InferenceThreshold}
|
threshold={GPUUsageThreshold}
|
||||||
data={[series]}
|
updateTimes={updateTimes}
|
||||||
/>
|
|
||||||
))}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className="p-2.5 bg-primary rounded-2xl flex-col">
|
|
||||||
<div className="mb-5">Detector CPU Usage</div>
|
|
||||||
{detCpuSeries.map((series) => (
|
|
||||||
<SystemGraph
|
|
||||||
key={series.name}
|
|
||||||
graphId="detector-cpu-usages"
|
|
||||||
unit="%"
|
|
||||||
name={series.name}
|
|
||||||
threshold={DetectorCpuThreshold}
|
|
||||||
data={[series]}
|
data={[series]}
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
<div className="p-2.5 bg-primary rounded-2xl flex-col">
|
<div className="p-2.5 bg-primary rounded-2xl flex-col">
|
||||||
<div className="mb-5">Detector Memory Usage</div>
|
<div className="mb-5">GPU Memory</div>
|
||||||
{detMemSeries.map((series) => (
|
{gpuMemSeries.map((series) => (
|
||||||
<SystemGraph
|
<SystemGraph
|
||||||
key={series.name}
|
key={series.name}
|
||||||
graphId="detector-mem-usages"
|
graphId={`${series.name}-mem`}
|
||||||
unit="%"
|
unit=""
|
||||||
name={series.name}
|
name={series.name}
|
||||||
threshold={DetectorMemThreshold}
|
threshold={GPUMemThreshold}
|
||||||
|
updateTimes={updateTimes}
|
||||||
data={[series]}
|
data={[series]}
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
@ -624,6 +560,45 @@ function GeneralMetrics() {
|
|||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
<div className="mt-4 text-muted-foreground text-sm font-medium">
|
||||||
|
Other Processes
|
||||||
</div>
|
</div>
|
||||||
|
<div className="mt-4 grid grid-cols-1 sm:grid-cols-2 gap-2">
|
||||||
|
<div className="p-2.5 bg-primary rounded-2xl flex-col">
|
||||||
|
<div className="mb-5">Process CPU Usage</div>
|
||||||
|
{otherProcessCpuSeries.map((series) => (
|
||||||
|
<SystemGraph
|
||||||
|
key={series.name}
|
||||||
|
graphId={`${series.name}-cpu`}
|
||||||
|
name={series.name.replaceAll("_", " ")}
|
||||||
|
unit="%"
|
||||||
|
threshold={InferenceThreshold}
|
||||||
|
updateTimes={updateTimes}
|
||||||
|
data={[series]}
|
||||||
|
/>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
<div className="p-2.5 bg-primary rounded-2xl flex-col">
|
||||||
|
<div className="mb-5">Process Memory Usage</div>
|
||||||
|
{otherProcessMemSeries.map((series) => (
|
||||||
|
<SystemGraph
|
||||||
|
key={series.name}
|
||||||
|
graphId={`${series.name}-mem`}
|
||||||
|
unit="%"
|
||||||
|
name={series.name.replaceAll("_", " ")}
|
||||||
|
threshold={DetectorMemThreshold}
|
||||||
|
updateTimes={updateTimes}
|
||||||
|
data={[series]}
|
||||||
|
/>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function CameraMetrics() {
|
||||||
|
const { data: config } = useSWR<FrigateConfig>("config");
|
||||||
|
}
|
||||||
|
|||||||
@ -28,6 +28,16 @@ export const DetectorMemThreshold = {
|
|||||||
error: 50,
|
error: 50,
|
||||||
} as Threshold;
|
} as Threshold;
|
||||||
|
|
||||||
|
export const GPUUsageThreshold = {
|
||||||
|
warning: 75,
|
||||||
|
error: 95,
|
||||||
|
} as Threshold;
|
||||||
|
|
||||||
|
export const GPUMemThreshold = {
|
||||||
|
warning: 75,
|
||||||
|
error: 95,
|
||||||
|
} as Threshold;
|
||||||
|
|
||||||
export const CameraFfmpegThreshold = {
|
export const CameraFfmpegThreshold = {
|
||||||
warning: 20,
|
warning: 20,
|
||||||
error: 20,
|
error: 20,
|
||||||
|
|||||||
@ -63,3 +63,9 @@ export type PotentialProblem = {
|
|||||||
text: string;
|
text: string;
|
||||||
color: string;
|
color: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export type Vainfo = {
|
||||||
|
return_code: number;
|
||||||
|
stdout: string;
|
||||||
|
stderr: string;
|
||||||
|
};
|
||||||
|
|||||||
@ -12,24 +12,24 @@ export default defineConfig({
|
|||||||
server: {
|
server: {
|
||||||
proxy: {
|
proxy: {
|
||||||
"/api": {
|
"/api": {
|
||||||
target: "http://192.168.50.106:5000",
|
target: "http://localhost:5000",
|
||||||
ws: true,
|
ws: true,
|
||||||
},
|
},
|
||||||
"/vod": {
|
"/vod": {
|
||||||
target: "http://192.168.50.106:5000",
|
target: "http://localhost:5000",
|
||||||
},
|
},
|
||||||
"/clips": {
|
"/clips": {
|
||||||
target: "http://192.168.50.106:5000",
|
target: "http://localhost:5000",
|
||||||
},
|
},
|
||||||
"/exports": {
|
"/exports": {
|
||||||
target: "http://192.168.50.106:5000",
|
target: "http://localhost:5000",
|
||||||
},
|
},
|
||||||
"/ws": {
|
"/ws": {
|
||||||
target: "ws://192.168.50.106:5000",
|
target: "ws://localhost:5000",
|
||||||
ws: true,
|
ws: true,
|
||||||
},
|
},
|
||||||
"/live": {
|
"/live": {
|
||||||
target: "ws://192.168.50.106:5000",
|
target: "ws://localhost:5000",
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
ws: true,
|
ws: true,
|
||||||
},
|
},
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user