containerd/metrics/cgroups/hugetlb.go
Michael Crosby 2ed3c62e27 Update cgroups to 5933ab4dc4f7caa3a73a1dc141bd11f4
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-09-06 16:20:19 -04:00

73 lines
1.5 KiB
Go

// +build linux
package cgroups
import (
"github.com/containerd/cgroups"
metrics "github.com/docker/go-metrics"
"github.com/prometheus/client_golang/prometheus"
)
var hugetlbMetrics = []*metric{
{
name: "hugetlb_usage",
help: "The hugetlb usage",
unit: metrics.Bytes,
vt: prometheus.GaugeValue,
labels: []string{"page"},
getValues: func(stats *cgroups.Metrics) []value {
if stats.Hugetlb == nil {
return nil
}
var out []value
for _, v := range stats.Hugetlb {
out = append(out, value{
v: float64(v.Usage),
l: []string{v.Pagesize},
})
}
return out
},
},
{
name: "hugetlb_failcnt",
help: "The hugetlb failcnt",
unit: metrics.Total,
vt: prometheus.GaugeValue,
labels: []string{"page"},
getValues: func(stats *cgroups.Metrics) []value {
if stats.Hugetlb == nil {
return nil
}
var out []value
for _, v := range stats.Hugetlb {
out = append(out, value{
v: float64(v.Failcnt),
l: []string{v.Pagesize},
})
}
return out
},
},
{
name: "hugetlb_max",
help: "The hugetlb maximum usage",
unit: metrics.Bytes,
vt: prometheus.GaugeValue,
labels: []string{"page"},
getValues: func(stats *cgroups.Metrics) []value {
if stats.Hugetlb == nil {
return nil
}
var out []value
for _, v := range stats.Hugetlb {
out = append(out, value{
v: float64(v.Max),
l: []string{v.Pagesize},
})
}
return out
},
},
}