|
|
@ -19,16 +19,23 @@ package collector |
|
|
|
import ( |
|
|
|
import ( |
|
|
|
"fmt" |
|
|
|
"fmt" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"github.com/alecthomas/kingpin/v2" |
|
|
|
"github.com/go-kit/log" |
|
|
|
"github.com/go-kit/log" |
|
|
|
"github.com/prometheus/client_golang/prometheus" |
|
|
|
"github.com/prometheus/client_golang/prometheus" |
|
|
|
"github.com/prometheus/procfs" |
|
|
|
"github.com/prometheus/procfs" |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var ( |
|
|
|
|
|
|
|
slabNameInclude = kingpin.Flag("collector.slabinfo.slabs-include", "Regexp of slabs to include in slabinfo collector.").Default(".*").String() |
|
|
|
|
|
|
|
slabNameExclude = kingpin.Flag("collector.slabinfo.slabs-exclude", "Regexp of slabs to exclude in slabinfo collector.").Default("").String() |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
type slabinfoCollector struct { |
|
|
|
type slabinfoCollector struct { |
|
|
|
fs procfs.FS |
|
|
|
fs procfs.FS |
|
|
|
logger log.Logger |
|
|
|
logger log.Logger |
|
|
|
subsystem string |
|
|
|
subsystem string |
|
|
|
labels []string |
|
|
|
labels []string |
|
|
|
|
|
|
|
slabNameFilter deviceFilter |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func init() { |
|
|
|
func init() { |
|
|
@ -45,6 +52,7 @@ func NewSlabinfoCollector(logger log.Logger) (Collector, error) { |
|
|
|
fs: fs, |
|
|
|
fs: fs, |
|
|
|
subsystem: "slabinfo", |
|
|
|
subsystem: "slabinfo", |
|
|
|
labels: []string{"slab"}, |
|
|
|
labels: []string{"slab"}, |
|
|
|
|
|
|
|
slabNameFilter: newDeviceFilter(*slabNameExclude, *slabNameInclude), |
|
|
|
}, nil |
|
|
|
}, nil |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -55,6 +63,9 @@ func (c *slabinfoCollector) Update(ch chan<- prometheus.Metric) error { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
for _, slab := range slabinfo.Slabs { |
|
|
|
for _, slab := range slabinfo.Slabs { |
|
|
|
|
|
|
|
if c.slabNameFilter.ignored(slab.Name) { |
|
|
|
|
|
|
|
continue |
|
|
|
|
|
|
|
} |
|
|
|
ch <- c.activeObjects(slab.Name, slab.ObjActive) |
|
|
|
ch <- c.activeObjects(slab.Name, slab.ObjActive) |
|
|
|
ch <- c.objects(slab.Name, slab.ObjNum) |
|
|
|
ch <- c.objects(slab.Name, slab.ObjNum) |
|
|
|
ch <- c.objectSizeBytes(slab.Name, slab.ObjSize) |
|
|
|
ch <- c.objectSizeBytes(slab.Name, slab.ObjSize) |
|
|
|