Merge pull request #1754 from bsingr/master
Add memory reservation in prom `/metrics` endpoint.
This commit is contained in:
commit
76538e77a5
@ -794,6 +794,8 @@ func (c *PrometheusCollector) collectContainersInfo(ch chan<- prometheus.Metric)
|
|||||||
ch <- prometheus.MustNewConstMetric(desc, prometheus.GaugeValue, specMemoryValue(container.Spec.Memory.Limit), values...)
|
ch <- prometheus.MustNewConstMetric(desc, prometheus.GaugeValue, specMemoryValue(container.Spec.Memory.Limit), values...)
|
||||||
desc = prometheus.NewDesc("container_spec_memory_swap_limit_bytes", "Memory swap limit for the container.", labels, nil)
|
desc = prometheus.NewDesc("container_spec_memory_swap_limit_bytes", "Memory swap limit for the container.", labels, nil)
|
||||||
ch <- prometheus.MustNewConstMetric(desc, prometheus.GaugeValue, specMemoryValue(container.Spec.Memory.SwapLimit), values...)
|
ch <- prometheus.MustNewConstMetric(desc, prometheus.GaugeValue, specMemoryValue(container.Spec.Memory.SwapLimit), values...)
|
||||||
|
desc = prometheus.NewDesc("container_spec_memory_reservation_limit_bytes", "Memory reservation limit for the container.", labels, nil)
|
||||||
|
ch <- prometheus.MustNewConstMetric(desc, prometheus.GaugeValue, specMemoryValue(container.Spec.Memory.Reservation), values...)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now for the actual metrics
|
// Now for the actual metrics
|
||||||
|
@ -63,6 +63,11 @@ func (p testSubcontainersInfoProvider) SubcontainersInfo(string, *info.Container
|
|||||||
Period: 100000,
|
Period: 100000,
|
||||||
Quota: 10000,
|
Quota: 10000,
|
||||||
},
|
},
|
||||||
|
Memory: info.MemorySpec{
|
||||||
|
Limit: 2048,
|
||||||
|
Reservation: 1024,
|
||||||
|
SwapLimit: 4096,
|
||||||
|
},
|
||||||
CreationTime: time.Unix(1257894000, 0),
|
CreationTime: time.Unix(1257894000, 0),
|
||||||
Labels: map[string]string{
|
Labels: map[string]string{
|
||||||
"foo.label": "bar",
|
"foo.label": "bar",
|
||||||
|
Loading…
Reference in New Issue
Block a user