mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-04-03 13:54:55 +03:00
Update handling of stats to be simpler
This commit is contained in:
parent
3835e7649c
commit
31bd461ece
@ -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(
|
||||
|
||||
@ -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":
|
||||
|
||||
@ -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));
|
||||
|
||||
Loading…
Reference in New Issue
Block a user