expose RSS

This commit is contained in:
Shimin Guo 2015-12-30 22:54:32 -08:00
parent 290a84417c
commit 1a867bdadd
3 changed files with 13 additions and 0 deletions

View File

@ -378,6 +378,7 @@ func toContainerStats1(s *cgroups.Stats, ret *info.ContainerStats) {
func toContainerStats2(s *cgroups.Stats, ret *info.ContainerStats) {
ret.Memory.Usage = s.MemoryStats.Usage.Usage
ret.Memory.Failcnt = s.MemoryStats.Usage.Failcnt
ret.Memory.RSS = s.MemoryStats.Stats["rss"]
if v, ok := s.MemoryStats.Stats["pgfault"]; ok {
ret.Memory.ContainerData.Pgfault = v
ret.Memory.HierarchicalData.Pgfault = v

View File

@ -308,6 +308,11 @@ type MemoryStats struct {
// Units: Bytes.
Usage uint64 `json:"usage"`
// The amount of anonymous and swap cache memory (includes transparent
// hugepages).
// Units: Bytes.
RSS uint64 `json:"rss"`
// The amount of working set memory, this includes recently accessed memory,
// dirty memory, and kernel memory. Working set is <= "usage".
// Units: Bytes.

View File

@ -127,6 +127,13 @@ func NewPrometheusCollector(infoProvider infoProvider, f ContainerNameToLabelsFu
}
return values
},
}, {
name: "container_memory_rss",
help: "Size of RSS in bytes",
valueType: prometheus.GaugeValue,
getValues: func(s *info.ContainerStats) metricValues {
return metricValues{{value: float64(s.Memory.RSS)}}
},
}, {
name: "container_memory_failcnt",
help: "Number of memory usage hits limits",