diff --git a/frigate/stats/emitter.py b/frigate/stats/emitter.py index 2c29548e9..a90be5271 100644 --- a/frigate/stats/emitter.py +++ b/frigate/stats/emitter.py @@ -16,7 +16,8 @@ from frigate.types import StatsTrackingTypes logger = logging.getLogger(__name__) -MAX_STATS_POINTS = 120 +MAX_STATS_POINTS = 80 +FREQUENCY_STATS_POINTS = 15 class StatsEmitter(threading.Thread): @@ -70,9 +71,9 @@ class StatsEmitter(threading.Thread): def run(self) -> None: time.sleep(10) for counter in itertools.cycle( - range(int(self.config.mqtt.stats_interval / 10)) + range(int(self.config.mqtt.stats_interval / FREQUENCY_STATS_POINTS)) ): - if self.stop_event.wait(10): + if self.stop_event.wait(FREQUENCY_STATS_POINTS): break logger.debug("Starting stats collection") diff --git a/web/src/components/graph/SystemGraph.tsx b/web/src/components/graph/SystemGraph.tsx index b7c1a5731..a6ca219b0 100644 --- a/web/src/components/graph/SystemGraph.tsx +++ b/web/src/components/graph/SystemGraph.tsx @@ -87,6 +87,9 @@ export function ThresholdBarGraph({ tooltip: { theme: systemTheme || theme, }, + markers: { + size: 0, + }, xaxis: { tickAmount: 4, tickPlacement: "on", @@ -105,7 +108,7 @@ export function ThresholdBarGraph({ min: 0, max: threshold.warning + 10, }, - }; + } as ApexCharts.ApexOptions; }, [graphId, threshold, systemTheme, theme, formatTime]); useEffect(() => { diff --git a/web/src/views/system/GeneralMetrics.tsx b/web/src/views/system/GeneralMetrics.tsx index ccee33190..ba486b2e6 100644 --- a/web/src/views/system/GeneralMetrics.tsx +++ b/web/src/views/system/GeneralMetrics.tsx @@ -12,6 +12,7 @@ import { import { Button } from "@/components/ui/button"; import VainfoDialog from "@/components/overlay/VainfoDialog"; import { ThresholdBarGraph } from "@/components/graph/SystemGraph"; +import { Skeleton } from "@/components/ui/skeleton"; type GeneralMetricsProps = { lastUpdated: number; @@ -264,10 +265,6 @@ export default function GeneralMetrics({ return Object.values(series); }, [statsHistory]); - if (statsHistory.length == 0) { - return; - } - return ( <> @@ -276,102 +273,123 @@ export default function GeneralMetrics({
Detectors
-
-
-
Detector Inference Speed
- {detInferenceTimeSeries.map((series) => ( - - ))} -
-
-
Detector CPU Usage
- {detCpuSeries.map((series) => ( - - ))} -
-
-
Detector Memory Usage
- {detMemSeries.map((series) => ( - - ))} -
+
+ {detInferenceTimeSeries.length != 0 ? ( +
+
Detector Inference Speed
+ {detInferenceTimeSeries.map((series) => ( + + ))} +
+ ) : ( + + )} + {statsHistory.length != 0 ? ( +
+
Detector CPU Usage
+ {detCpuSeries.map((series) => ( + + ))} +
+ ) : ( + + )} + {statsHistory.length != 0 ? ( +
+
Detector Memory Usage
+ {detMemSeries.map((series) => ( + + ))} +
+ ) : ( + + )}
- {statsHistory.length > 0 && statsHistory[0].gpu_usages && ( + {(statsHistory.length == 0 || statsHistory[0].gpu_usages) && ( <>
GPUs
- {Object.keys(statsHistory[0].gpu_usages).filter( - (key) => - key == "amd-vaapi" || - key == "intel-vaapi" || - key == "intel-qsv", - ).length > 0 && ( - - )} + {statsHistory.length > 0 && + Object.keys(statsHistory[0].gpu_usages ?? {}).filter( + (key) => + key == "amd-vaapi" || + key == "intel-vaapi" || + key == "intel-qsv", + ).length > 0 && ( + + )}
-
-
GPU Usage
- {gpuSeries.map((series) => ( - - ))} -
-
-
GPU Memory
- {gpuMemSeries.map((series) => ( - - ))} -
+ {statsHistory.length != 0 ? ( +
+
GPU Usage
+ {gpuSeries.map((series) => ( + + ))} +
+ ) : ( + + )} + {statsHistory.length != 0 ? ( +
+
GPU Memory
+ {gpuMemSeries.map((series) => ( + + ))} +
+ ) : ( + + )}
)} @@ -380,34 +398,42 @@ export default function GeneralMetrics({ Other Processes
-
-
Process CPU Usage
- {otherProcessCpuSeries.map((series) => ( - - ))} -
-
-
Process Memory Usage
- {otherProcessMemSeries.map((series) => ( - - ))} -
+ {statsHistory.length != 0 ? ( +
+
Process CPU Usage
+ {otherProcessCpuSeries.map((series) => ( + + ))} +
+ ) : ( + + )} + {statsHistory.length != 0 ? ( +
+
Process Memory Usage
+ {otherProcessMemSeries.map((series) => ( + + ))} +
+ ) : ( + + )}