Merge pull request #1754 from bsingr/master

Add memory reservation in prom `/metrics` endpoint.
This commit is contained in:
David Ashpole 2017-09-19 15:11:18 -07:00 committed by GitHub
commit 76538e77a5
2 changed files with 7 additions and 0 deletions

View File

@ -794,6 +794,8 @@ func (c *PrometheusCollector) collectContainersInfo(ch chan<- prometheus.Metric)
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)
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

View File

@ -63,6 +63,11 @@ func (p testSubcontainersInfoProvider) SubcontainersInfo(string, *info.Container
Period: 100000,
Quota: 10000,
},
Memory: info.MemorySpec{
Limit: 2048,
Reservation: 1024,
SwapLimit: 4096,
},
CreationTime: time.Unix(1257894000, 0),
Labels: map[string]string{
"foo.label": "bar",