From 31bd461ecebbeee75505c9e1cc88f1f3288ca63f Mon Sep 17 00:00:00 2001 From: Nicolas Mowen Date: Sat, 28 Mar 2026 10:21:57 -0600 Subject: [PATCH] Update handling of stats to be simpler --- frigate/stats/prometheus.py | 14 ++++++++++++++ web/src/components/Statusbar.tsx | 3 +-- web/src/views/system/GeneralMetrics.tsx | 10 ++++------ 3 files changed, 19 insertions(+), 8 deletions(-) diff --git a/frigate/stats/prometheus.py b/frigate/stats/prometheus.py index 67d8d03d8..874b03892 100644 --- a/frigate/stats/prometheus.py +++ b/frigate/stats/prometheus.py @@ -355,16 +355,30 @@ class CustomCollector(object): gpu_mem_usages = GaugeMetricFamily( "frigate_gpu_mem_usage_percent", "GPU memory usage %", labels=["gpu_name"] ) + gpu_enc_usages = GaugeMetricFamily( + "frigate_gpu_encoder_usage_percent", + "GPU encoder utilisation %", + labels=["gpu_name"], + ) + gpu_dec_usages = GaugeMetricFamily( + "frigate_gpu_decoder_usage_percent", + "GPU decoder utilisation %", + labels=["gpu_name"], + ) try: for gpu_name, gpu_stats in stats["gpu_usages"].items(): self.add_metric(gpu_usages, [gpu_name], gpu_stats, "gpu") self.add_metric(gpu_mem_usages, [gpu_name], gpu_stats, "mem") + self.add_metric(gpu_enc_usages, [gpu_name], gpu_stats, "enc") + self.add_metric(gpu_dec_usages, [gpu_name], gpu_stats, "dec") except KeyError: pass yield gpu_usages yield gpu_mem_usages + yield gpu_enc_usages + yield gpu_dec_usages # service stats uptime_seconds = GaugeMetricFamily( diff --git a/web/src/components/Statusbar.tsx b/web/src/components/Statusbar.tsx index d1035dd60..18a0d9ee1 100644 --- a/web/src/components/Statusbar.tsx +++ b/web/src/components/Statusbar.tsx @@ -116,8 +116,7 @@ export default function Statusbar() { case "amd-vaapi": gpuTitle = "AMD GPU"; break; - case "intel-vaapi": - case "intel-qsv": + case "intel-gpu": gpuTitle = "Intel GPU"; break; case "rockchip": diff --git a/web/src/views/system/GeneralMetrics.tsx b/web/src/views/system/GeneralMetrics.tsx index 2bac7cd2b..e78486767 100644 --- a/web/src/views/system/GeneralMetrics.tsx +++ b/web/src/views/system/GeneralMetrics.tsx @@ -76,7 +76,7 @@ export default function GeneralMetrics({ statsHistory.length > 0 && Object.keys(statsHistory[0]?.gpu_usages ?? {}).forEach((key) => { - if (key == "amd-vaapi" || key == "intel-vaapi" || key == "intel-qsv") { + if (key == "amd-vaapi" || key == "intel-gpu") { vaCount += 1; } @@ -265,7 +265,7 @@ export default function GeneralMetrics({ if ( Object.keys(statsHistory?.at(0)?.gpu_usages ?? {}).length == 1 && - Object.keys(statsHistory?.at(0)?.gpu_usages ?? {})[0].includes("intel") + Object.keys(statsHistory?.at(0)?.gpu_usages ?? {})[0] === "intel-gpu" ) { // intel gpu stats do not support memory return undefined; @@ -409,9 +409,7 @@ export default function GeneralMetrics({ } const gpuKeys = Object.keys(statsHistory[0]?.gpu_usages ?? {}); - const hasIntelGpu = gpuKeys.some( - (key) => key === "intel-vaapi" || key === "intel-qsv", - ); + const hasIntelGpu = gpuKeys.some((key) => key === "intel-gpu"); if (!hasIntelGpu) { return false; @@ -427,7 +425,7 @@ export default function GeneralMetrics({ } Object.entries(stats.gpu_usages || {}).forEach(([key, gpuStats]) => { - if (key === "intel-vaapi" || key === "intel-qsv") { + if (key === "intel-gpu") { if (gpuStats.gpu) { hasDataPoints = true; const gpuValue = parseFloat(gpuStats.gpu.slice(0, -1));