expose thresholds in ms for detectors to warn or error

This commit is contained in:
Eric W
2026-03-12 19:10:01 -04:00
parent 324953d3a5
commit b13fa77edd
5 changed files with 51 additions and 4 deletions
+8 -2
View File
@@ -50,8 +50,14 @@ export default function useStats(stats: FrigateStats | undefined) {
}
// check detectors for high inference speeds
const inferenceThreshold = {
warning:
config?.ui?.inference_threshold?.warning ?? InferenceThreshold.warning,
error:
config?.ui?.inference_threshold?.error ?? InferenceThreshold.error,
};
Object.entries(memoizedStats["detectors"]).forEach(([key, det]) => {
if (det["inference_speed"] > InferenceThreshold.error) {
if (det["inference_speed"] > inferenceThreshold.error) {
problems.push({
text: t("stats.detectIsVerySlow", {
detect: capitalizeFirstLetter(key),
@@ -60,7 +66,7 @@ export default function useStats(stats: FrigateStats | undefined) {
color: "text-danger",
relevantLink: "/system#general",
});
} else if (det["inference_speed"] > InferenceThreshold.warning) {
} else if (det["inference_speed"] > inferenceThreshold.warning) {
problems.push({
text: t("stats.detectIsSlow", {
detect: capitalizeFirstLetter(key),
+4
View File
@@ -9,6 +9,10 @@ export interface UiConfig {
dashboard: boolean;
order: number;
unit_system?: "metric" | "imperial";
inference_threshold?: {
warning: number;
error: number;
};
}
export interface BirdseyeConfig {
+8 -1
View File
@@ -1,4 +1,5 @@
import useSWR from "swr";
import { FrigateConfig } from "@/types/frigateConfig";
import { FrigateStats, GpuInfo } from "@/types/stats";
import { useEffect, useMemo, useState } from "react";
import { useFrigateStats } from "@/api/ws";
@@ -34,6 +35,12 @@ export default function GeneralMetrics({
// extra info
const { t } = useTranslation(["views/system"]);
const [showVainfo, setShowVainfo] = useState(false);
const { data: config } = useSWR<FrigateConfig>("config");
const inferenceThreshold = {
warning:
config?.ui?.inference_threshold?.warning ?? InferenceThreshold.warning,
error: config?.ui?.inference_threshold?.error ?? InferenceThreshold.error,
};
// stats
@@ -626,7 +633,7 @@ export default function GeneralMetrics({
graphId={`${series.name}-inference`}
name={series.name}
unit="ms"
threshold={InferenceThreshold}
threshold={inferenceThreshold}
updateTimes={updateTimes}
data={[series]}
/>