From 76238d71611904d8a50d7840c2150092657044a6 Mon Sep 17 00:00:00 2001 From: 0fatal <72899968+0fatal@users.noreply.github.com> Date: Wed, 23 Aug 2023 16:11:29 +0800 Subject: [PATCH] fix(server): correct monitor metrics promql (#1485) --- server/src/monitor/monitor.service.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/src/monitor/monitor.service.ts b/server/src/monitor/monitor.service.ts index a292356194..54b2d6e1e6 100644 --- a/server/src/monitor/monitor.service.ts +++ b/server/src/monitor/monitor.service.ts @@ -18,7 +18,7 @@ export const getQuery = case MonitorMetric.cpuUsage: return { instant: false, - query: `sum(rate(container_cpu_usage_seconds_total{pod=~"${opts.pods}",namespace="${opts.namespace}"}[${rateAccuracy}])) by (${opts.selector})`, + query: `sum(rate(container_cpu_usage_seconds_total{image!="",container!="",pod=~"${opts.pods}",namespace="${opts.namespace}"}[${rateAccuracy}])) by (${opts.selector})`, } // case MonitorMetric.cpuRequests: // return { @@ -33,7 +33,7 @@ export const getQuery = case MonitorMetric.memoryUsage: return { instant: false, - query: `sum(container_memory_working_set_bytes{pod=~"${opts.pods}",namespace="${opts.namespace}"}) by (${opts.selector})`, + query: `sum(container_memory_working_set_bytes{image!="",container!="",pod=~"${opts.pods}",namespace="${opts.namespace}"}) by (${opts.selector})`, } // case MonitorMetric.memoryRequests: // return {