From ea200862710616505364772a93b3a4112f2e7536 Mon Sep 17 00:00:00 2001 From: payall4u Date: Sun, 21 Jan 2024 00:22:31 +0800 Subject: [PATCH] Fix crane agent panic when pod use ext memory Signed-off-by: payall4u --- pkg/ensurance/collector/cadvisor/cadvisor_linux.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/ensurance/collector/cadvisor/cadvisor_linux.go b/pkg/ensurance/collector/cadvisor/cadvisor_linux.go index ce0416a57..8f331399c 100644 --- a/pkg/ensurance/collector/cadvisor/cadvisor_linux.go +++ b/pkg/ensurance/collector/cadvisor/cadvisor_linux.go @@ -163,7 +163,7 @@ func (c *CadvisorCollector) Collect() (map[string][]common.TimeSeries, error) { continue } - if hasExtMemRes { + if hasExtMemRes && v.Stats[0].Memory != nil { extResMemUse += float64(v.Stats[0].Memory.WorkingSet) }