Check the length before using container.Stats
This commit is contained in:
parent
97fcafeb0b
commit
910de81342
@ -953,6 +953,9 @@ func (c *PrometheusCollector) collectContainersInfo(ch chan<- prometheus.Metric)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Now for the actual metrics
|
// Now for the actual metrics
|
||||||
|
if len(container.Stats) == 0 {
|
||||||
|
continue
|
||||||
|
}
|
||||||
stats := container.Stats[0]
|
stats := container.Stats[0]
|
||||||
for _, cm := range c.containerMetrics {
|
for _, cm := range c.containerMetrics {
|
||||||
if cm.condition != nil && !cm.condition(container.Spec) {
|
if cm.condition != nil && !cm.condition(container.Spec) {
|
||||||
|
Loading…
Reference in New Issue
Block a user