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(
|
gpu_mem_usages = GaugeMetricFamily(
|
||||||
"frigate_gpu_mem_usage_percent", "GPU memory usage %", labels=["gpu_name"]
|
"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:
|
try:
|
||||||
for gpu_name, gpu_stats in stats["gpu_usages"].items():
|
for gpu_name, gpu_stats in stats["gpu_usages"].items():
|
||||||
self.add_metric(gpu_usages, [gpu_name], gpu_stats, "gpu")
|
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_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:
|
except KeyError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
yield gpu_usages
|
yield gpu_usages
|
||||||
yield gpu_mem_usages
|
yield gpu_mem_usages
|
||||||
|
yield gpu_enc_usages
|
||||||
|
yield gpu_dec_usages
|
||||||
|
|
||||||
# service stats
|
# service stats
|
||||||
uptime_seconds = GaugeMetricFamily(
|
uptime_seconds = GaugeMetricFamily(
|
||||||
|
|||||||
@ -116,8 +116,7 @@ export default function Statusbar() {
|
|||||||
case "amd-vaapi":
|
case "amd-vaapi":
|
||||||
gpuTitle = "AMD GPU";
|
gpuTitle = "AMD GPU";
|
||||||
break;
|
break;
|
||||||
case "intel-vaapi":
|
case "intel-gpu":
|
||||||
case "intel-qsv":
|
|
||||||
gpuTitle = "Intel GPU";
|
gpuTitle = "Intel GPU";
|
||||||
break;
|
break;
|
||||||
case "rockchip":
|
case "rockchip":
|
||||||
|
|||||||
@ -76,7 +76,7 @@ export default function GeneralMetrics({
|
|||||||
|
|
||||||
statsHistory.length > 0 &&
|
statsHistory.length > 0 &&
|
||||||
Object.keys(statsHistory[0]?.gpu_usages ?? {}).forEach((key) => {
|
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;
|
vaCount += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -265,7 +265,7 @@ export default function GeneralMetrics({
|
|||||||
|
|
||||||
if (
|
if (
|
||||||
Object.keys(statsHistory?.at(0)?.gpu_usages ?? {}).length == 1 &&
|
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
|
// intel gpu stats do not support memory
|
||||||
return undefined;
|
return undefined;
|
||||||
@ -409,9 +409,7 @@ export default function GeneralMetrics({
|
|||||||
}
|
}
|
||||||
|
|
||||||
const gpuKeys = Object.keys(statsHistory[0]?.gpu_usages ?? {});
|
const gpuKeys = Object.keys(statsHistory[0]?.gpu_usages ?? {});
|
||||||
const hasIntelGpu = gpuKeys.some(
|
const hasIntelGpu = gpuKeys.some((key) => key === "intel-gpu");
|
||||||
(key) => key === "intel-vaapi" || key === "intel-qsv",
|
|
||||||
);
|
|
||||||
|
|
||||||
if (!hasIntelGpu) {
|
if (!hasIntelGpu) {
|
||||||
return false;
|
return false;
|
||||||
@ -427,7 +425,7 @@ export default function GeneralMetrics({
|
|||||||
}
|
}
|
||||||
|
|
||||||
Object.entries(stats.gpu_usages || {}).forEach(([key, gpuStats]) => {
|
Object.entries(stats.gpu_usages || {}).forEach(([key, gpuStats]) => {
|
||||||
if (key === "intel-vaapi" || key === "intel-qsv") {
|
if (key === "intel-gpu") {
|
||||||
if (gpuStats.gpu) {
|
if (gpuStats.gpu) {
|
||||||
hasDataPoints = true;
|
hasDataPoints = true;
|
||||||
const gpuValue = parseFloat(gpuStats.gpu.slice(0, -1));
|
const gpuValue = parseFloat(gpuStats.gpu.slice(0, -1));
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user