Documentation ¶
Overview ¶
Package memstat implements metrics collection related to Memory usage
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CgroupStat ¶
type CgroupStat struct { Cgroups map[string]*PerCgroupStat Mountpoint string // contains filtered or unexported fields }
CgroupStat represents memory usage statistics for all non-default cgroups associated with cgroup memory controller
func NewCgroupStat ¶
func NewCgroupStat(m *metrics.MetricContext, Step time.Duration) *CgroupStat
NewCgroupStat registers with metriccontext and starts metric collection every Step
func (*CgroupStat) Collect ¶
func (c *CgroupStat) Collect(mountpoint string)
Collect gathers memory usage statistics for all cgroups registered with non-default cgroup with memory controller. cgroups without any tasks are ignored.
type MemStat ¶
type MemStat struct { MemTotal *metrics.Gauge MemFree *metrics.Gauge Buffers *metrics.Gauge Cached *metrics.Gauge SwapCached *metrics.Gauge Active *metrics.Gauge Inactive *metrics.Gauge Active_anon *metrics.Gauge Inactive_anon *metrics.Gauge Active_file *metrics.Gauge Inactive_file *metrics.Gauge Unevictable *metrics.Gauge Mlocked *metrics.Gauge SwapTotal *metrics.Gauge SwapFree *metrics.Gauge Dirty *metrics.Gauge Writeback *metrics.Gauge AnonPages *metrics.Gauge Mapped *metrics.Gauge Shmem *metrics.Gauge Slab *metrics.Gauge SReclaimable *metrics.Gauge SUnreclaim *metrics.Gauge KernelStack *metrics.Gauge PageTables *metrics.Gauge NFS_Unstable *metrics.Gauge Bounce *metrics.Gauge WritebackTmp *metrics.Gauge CommitLimit *metrics.Gauge Committed_AS *metrics.Gauge VmallocTotal *metrics.Gauge VmallocUsed *metrics.Gauge VmallocChunk *metrics.Gauge HardwareCorrupted *metrics.Gauge AnonHugePages *metrics.Gauge HugePages_Total *metrics.Gauge HugePages_Free *metrics.Gauge HugePages_Rsvd *metrics.Gauge HugePages_Surp *metrics.Gauge Hugepagesize *metrics.Gauge DirectMap4k *metrics.Gauge DirectMap2M *metrics.Gauge // contains filtered or unexported fields }
MemStat represents statistics about memory subsystem Caution: reflection is used to populate matching fields in /proc/meminfo
func New ¶
func New(m *metrics.MetricContext, Step time.Duration) *MemStat
New registers with metriccontext and starts collecting metrics every Step
func (*MemStat) Collect ¶
func (s *MemStat) Collect()
Collect reads /proc/meminfo and populates MemStatMetrics
type PerCgroupStat ¶
type PerCgroupStat struct { // memory.stat Cache *metrics.Gauge Rss *metrics.Gauge Mapped_file *metrics.Gauge Pgpgin *metrics.Gauge Pgpgout *metrics.Gauge Swap *metrics.Gauge Active_anon *metrics.Gauge Inactive_anon *metrics.Gauge Active_file *metrics.Gauge Inactive_file *metrics.Gauge Unevictable *metrics.Gauge Hierarchical_memory_limit *metrics.Gauge Hierarchical_memsw_limit *metrics.Gauge Total_cache *metrics.Gauge Total_rss *metrics.Gauge Total_mapped_file *metrics.Gauge Total_pgpgin *metrics.Gauge Total_pgpgout *metrics.Gauge Total_swap *metrics.Gauge Total_inactive_anon *metrics.Gauge Total_active_anon *metrics.Gauge Total_inactive_file *metrics.Gauge Total_active_file *metrics.Gauge Total_unevictable *metrics.Gauge // memory.soft_limit_in_bytes Soft_Limit_In_Bytes *metrics.Gauge // Approximate usage in bytes UsageInBytes *metrics.Gauge // contains filtered or unexported fields }
PerCgroupStat represents statistics for a particular cgroup
func NewPerCgroupStat ¶
func NewPerCgroupStat(m *metrics.MetricContext, path string, mp string) *PerCgroupStat
NewPerCgroupStat registers with metriccontext for a particular cgroup
func (*PerCgroupStat) Collect ¶
func (s *PerCgroupStat) Collect()
Collect reads memory.stat and uses reflection to populate PerCgroupStat
func (*PerCgroupStat) SoftLimit ¶
func (s *PerCgroupStat) SoftLimit() float64
SoftLimit returns soft-limit for the cgroup
func (*PerCgroupStat) Unregister ¶
func (s *PerCgroupStat) Unregister()
Unregister removes any entries to the metrics names in metrics context
func (*PerCgroupStat) Usage ¶
func (s *PerCgroupStat) Usage() float64
Usage returns physical memory in use; not including buffers/cached/sreclaimable