Add device path to metrics
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
14
vendor/github.com/crosbymichael/cgroups/prometheus/blkio.go
generated
vendored
14
vendor/github.com/crosbymichael/cgroups/prometheus/blkio.go
generated
vendored
@@ -12,7 +12,7 @@ var blkioMetrics = []*metric{
|
||||
help: "The blkio io merged recursive",
|
||||
unit: metrics.Total,
|
||||
vt: prometheus.GaugeValue,
|
||||
labels: []string{"op", "major", "minor"},
|
||||
labels: []string{"op", "device", "major", "minor"},
|
||||
getValues: func(stats *cgroups.Stats) []value {
|
||||
if stats.Blkio == nil {
|
||||
return nil
|
||||
@@ -25,7 +25,7 @@ var blkioMetrics = []*metric{
|
||||
help: "The blkio io queued recursive",
|
||||
unit: metrics.Total,
|
||||
vt: prometheus.GaugeValue,
|
||||
labels: []string{"op", "major", "minor"},
|
||||
labels: []string{"op", "device", "major", "minor"},
|
||||
getValues: func(stats *cgroups.Stats) []value {
|
||||
if stats.Blkio == nil {
|
||||
return nil
|
||||
@@ -38,7 +38,7 @@ var blkioMetrics = []*metric{
|
||||
help: "The blkio io service bytes recursive",
|
||||
unit: metrics.Bytes,
|
||||
vt: prometheus.GaugeValue,
|
||||
labels: []string{"op", "major", "minor"},
|
||||
labels: []string{"op", "device", "major", "minor"},
|
||||
getValues: func(stats *cgroups.Stats) []value {
|
||||
if stats.Blkio == nil {
|
||||
return nil
|
||||
@@ -51,7 +51,7 @@ var blkioMetrics = []*metric{
|
||||
help: "The blkio io servie time recursive",
|
||||
unit: metrics.Total,
|
||||
vt: prometheus.GaugeValue,
|
||||
labels: []string{"op", "major", "minor"},
|
||||
labels: []string{"op", "device", "major", "minor"},
|
||||
getValues: func(stats *cgroups.Stats) []value {
|
||||
if stats.Blkio == nil {
|
||||
return nil
|
||||
@@ -64,7 +64,7 @@ var blkioMetrics = []*metric{
|
||||
help: "The blkio io servied recursive",
|
||||
unit: metrics.Total,
|
||||
vt: prometheus.GaugeValue,
|
||||
labels: []string{"op", "major", "minor"},
|
||||
labels: []string{"op", "device", "major", "minor"},
|
||||
getValues: func(stats *cgroups.Stats) []value {
|
||||
if stats.Blkio == nil {
|
||||
return nil
|
||||
@@ -77,7 +77,7 @@ var blkioMetrics = []*metric{
|
||||
help: "The blkio io time recursive",
|
||||
unit: metrics.Total,
|
||||
vt: prometheus.GaugeValue,
|
||||
labels: []string{"op", "major", "minor"},
|
||||
labels: []string{"op", "device", "major", "minor"},
|
||||
getValues: func(stats *cgroups.Stats) []value {
|
||||
if stats.Blkio == nil {
|
||||
return nil
|
||||
@@ -90,7 +90,7 @@ var blkioMetrics = []*metric{
|
||||
help: "The blkio sectors recursive",
|
||||
unit: metrics.Total,
|
||||
vt: prometheus.GaugeValue,
|
||||
labels: []string{"op", "major", "minor"},
|
||||
labels: []string{"op", "device", "major", "minor"},
|
||||
getValues: func(stats *cgroups.Stats) []value {
|
||||
if stats.Blkio == nil {
|
||||
return nil
|
||||
|
||||
4
vendor/github.com/crosbymichael/cgroups/prometheus/metrics.go
generated
vendored
4
vendor/github.com/crosbymichael/cgroups/prometheus/metrics.go
generated
vendored
@@ -59,7 +59,7 @@ func (c *Collector) Collect(ch chan<- prometheus.Metric) {
|
||||
|
||||
func (c *Collector) collect(id string, cg cgroups.Cgroup, ch chan<- prometheus.Metric, wg *sync.WaitGroup) {
|
||||
defer wg.Done()
|
||||
stats, err := cg.Stat()
|
||||
stats, err := cg.Stat(cgroups.IgnoreNotExist)
|
||||
if err != nil {
|
||||
logrus.WithError(err).Errorf("stat cgroup %s", id)
|
||||
return
|
||||
@@ -92,7 +92,7 @@ func blkioValues(l []cgroups.BlkioEntry) []value {
|
||||
for _, e := range l {
|
||||
out = append(out, value{
|
||||
v: float64(e.Value),
|
||||
l: []string{e.Op, strconv.FormatUint(e.Major, 10), strconv.FormatUint(e.Minor, 10)},
|
||||
l: []string{e.Op, e.Device, strconv.FormatUint(e.Major, 10), strconv.FormatUint(e.Minor, 10)},
|
||||
})
|
||||
}
|
||||
return out
|
||||
|
||||
Reference in New Issue
Block a user