mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-10-24 00:31:24 +00:00
Update cAdvisor to 2ed7198
* Add container_cpu_cfs_* metrics (CPU throttling due to limits)
* Add container_memory_swap metric
* Ensure minimum kernel version for thin_ls
Diff: c6c06d4...2ed7198
This commit is contained in:
35
vendor/github.com/google/cadvisor/metrics/prometheus.go
generated
vendored
35
vendor/github.com/google/cadvisor/metrics/prometheus.go
generated
vendored
@@ -63,6 +63,7 @@ type containerMetric struct {
|
||||
help string
|
||||
valueType prometheus.ValueType
|
||||
extraLabels []string
|
||||
condition func(s info.ContainerSpec) bool
|
||||
getValues func(s *info.ContainerStats) metricValues
|
||||
}
|
||||
|
||||
@@ -127,6 +128,30 @@ func NewPrometheusCollector(infoProvider infoProvider, f ContainerNameToLabelsFu
|
||||
}
|
||||
return values
|
||||
},
|
||||
}, {
|
||||
name: "container_cpu_cfs_periods_total",
|
||||
help: "Number of elapsed enforcement period intervals.",
|
||||
valueType: prometheus.CounterValue,
|
||||
condition: func(s info.ContainerSpec) bool { return s.Cpu.Quota != 0 },
|
||||
getValues: func(s *info.ContainerStats) metricValues {
|
||||
return metricValues{{value: float64(s.Cpu.CFS.Periods)}}
|
||||
},
|
||||
}, {
|
||||
name: "container_cpu_cfs_throttled_periods_total",
|
||||
help: "Number of throttled period intervals.",
|
||||
valueType: prometheus.CounterValue,
|
||||
condition: func(s info.ContainerSpec) bool { return s.Cpu.Quota != 0 },
|
||||
getValues: func(s *info.ContainerStats) metricValues {
|
||||
return metricValues{{value: float64(s.Cpu.CFS.ThrottledPeriods)}}
|
||||
},
|
||||
}, {
|
||||
name: "container_cpu_cfs_throttled_seconds_total",
|
||||
help: "Total time duration the container has been throttled.",
|
||||
valueType: prometheus.CounterValue,
|
||||
condition: func(s info.ContainerSpec) bool { return s.Cpu.Quota != 0 },
|
||||
getValues: func(s *info.ContainerStats) metricValues {
|
||||
return metricValues{{value: float64(s.Cpu.CFS.ThrottledTime) / float64(time.Second)}}
|
||||
},
|
||||
}, {
|
||||
name: "container_memory_cache",
|
||||
help: "Number of bytes of page cache memory.",
|
||||
@@ -141,6 +166,13 @@ func NewPrometheusCollector(infoProvider infoProvider, f ContainerNameToLabelsFu
|
||||
getValues: func(s *info.ContainerStats) metricValues {
|
||||
return metricValues{{value: float64(s.Memory.RSS)}}
|
||||
},
|
||||
}, {
|
||||
name: "container_memory_swap",
|
||||
help: "Container swap usage in bytes.",
|
||||
valueType: prometheus.GaugeValue,
|
||||
getValues: func(s *info.ContainerStats) metricValues {
|
||||
return metricValues{{value: float64(s.Memory.Swap)}}
|
||||
},
|
||||
}, {
|
||||
name: "container_memory_failcnt",
|
||||
help: "Number of memory usage hits limits",
|
||||
@@ -568,6 +600,9 @@ func (c *PrometheusCollector) collectContainersInfo(ch chan<- prometheus.Metric)
|
||||
// Now for the actual metrics
|
||||
stats := container.Stats[0]
|
||||
for _, cm := range c.containerMetrics {
|
||||
if cm.condition != nil && !cm.condition(container.Spec) {
|
||||
continue
|
||||
}
|
||||
desc := cm.desc(baseLabels)
|
||||
for _, metricValue := range cm.getValues(stats) {
|
||||
ch <- prometheus.MustNewConstMetric(desc, cm.valueType, float64(metricValue.value), append(baseLabelValues, metricValue.labels...)...)
|
||||
|
||||
Reference in New Issue
Block a user