expose page cache size

This commit is contained in:
Shimin Guo 2016-01-15 08:40:20 -08:00
parent 1a867bdadd
commit a26b58ec8e
3 changed files with 12 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.Cache = s.MemoryStats.Stats["cache"]
ret.Memory.RSS = s.MemoryStats.Stats["rss"]
if v, ok := s.MemoryStats.Stats["pgfault"]; ok {
ret.Memory.ContainerData.Pgfault = v

View File

@ -308,6 +308,10 @@ type MemoryStats struct {
// Units: Bytes.
Usage uint64 `json:"usage"`
// Number of bytes of page cache memory.
// Units: Bytes.
Cache uint64 `json:"cache"`
// The amount of anonymous and swap cache memory (includes transparent
// hugepages).
// Units: Bytes.

View File

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