mirror of
https://github.com/prometheus/node_exporter
synced 2024-12-25 15:42:10 +00:00
Remove config from collectors.
This commit is contained in:
parent
1ebda4c0aa
commit
f7563fe7a2
@ -24,19 +24,16 @@ import "C"
|
|||||||
const ()
|
const ()
|
||||||
|
|
||||||
type statCollector struct {
|
type statCollector struct {
|
||||||
config Config
|
cpu *prometheus.CounterVec
|
||||||
cpu *prometheus.CounterVec
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Factories["cpu"] = NewStatCollector
|
Factories["cpu"] = NewStatCollector
|
||||||
}
|
}
|
||||||
|
|
||||||
// Takes a config struct and prometheus registry and returns a new Collector exposing
|
// cpu stats.
|
||||||
// network device stats.
|
func NewStatCollector() (Collector, error) {
|
||||||
func NewStatCollector(config Config) (Collector, error) {
|
|
||||||
return &statCollector{
|
return &statCollector{
|
||||||
config: config,
|
|
||||||
cpu: prometheus.NewCounterVec(
|
cpu: prometheus.NewCounterVec(
|
||||||
prometheus.CounterOpts{
|
prometheus.CounterOpts{
|
||||||
Namespace: Namespace,
|
Namespace: Namespace,
|
||||||
|
@ -30,7 +30,6 @@ var (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type filesystemCollector struct {
|
type filesystemCollector struct {
|
||||||
config Config
|
|
||||||
ignoredMountPointsPattern *regexp.Regexp
|
ignoredMountPointsPattern *regexp.Regexp
|
||||||
|
|
||||||
size, free, avail, files, filesFree *prometheus.GaugeVec
|
size, free, avail, files, filesFree *prometheus.GaugeVec
|
||||||
@ -40,13 +39,11 @@ func init() {
|
|||||||
Factories["filesystem"] = NewFilesystemCollector
|
Factories["filesystem"] = NewFilesystemCollector
|
||||||
}
|
}
|
||||||
|
|
||||||
// Takes a config struct and prometheus registry and returns a new Collector exposing
|
// filesystems stats.
|
||||||
// network device filesystems.
|
func NewFilesystemCollector() (Collector, error) {
|
||||||
func NewFilesystemCollector(config Config) (Collector, error) {
|
|
||||||
var filesystemLabelNames = []string{"filesystem"}
|
var filesystemLabelNames = []string{"filesystem"}
|
||||||
|
|
||||||
return &filesystemCollector{
|
return &filesystemCollector{
|
||||||
config: config,
|
|
||||||
ignoredMountPointsPattern: regexp.MustCompile(*ignoredMountPoints),
|
ignoredMountPointsPattern: regexp.MustCompile(*ignoredMountPoints),
|
||||||
size: prometheus.NewGaugeVec(
|
size: prometheus.NewGaugeVec(
|
||||||
prometheus.GaugeOpts{
|
prometheus.GaugeOpts{
|
||||||
|
@ -24,8 +24,7 @@ func init() {
|
|||||||
loadavg[0] = 0
|
loadavg[0] = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
// Takes a prometheus registry and returns a new Collector exposing
|
// load1 stat.
|
||||||
// load, seconds since last login and a list of tags as specified by config.
|
|
||||||
func NewLoadavgCollector() (Collector, error) {
|
func NewLoadavgCollector() (Collector, error) {
|
||||||
return &loadavgCollector{
|
return &loadavgCollector{
|
||||||
metric: prometheus.NewGauge(prometheus.GaugeOpts{
|
metric: prometheus.NewGauge(prometheus.GaugeOpts{
|
||||||
|
@ -33,7 +33,6 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type meminfoCollector struct {
|
type meminfoCollector struct {
|
||||||
config Config
|
|
||||||
metrics map[string]prometheus.Gauge
|
metrics map[string]prometheus.Gauge
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -41,11 +40,9 @@ func init() {
|
|||||||
Factories["meminfo"] = NewMeminfoCollector
|
Factories["meminfo"] = NewMeminfoCollector
|
||||||
}
|
}
|
||||||
|
|
||||||
// Takes a config struct and prometheus registry and returns a new Collector exposing
|
|
||||||
// memory stats.
|
// memory stats.
|
||||||
func NewMeminfoCollector(config Config) (Collector, error) {
|
func NewMeminfoCollector() (Collector, error) {
|
||||||
return &meminfoCollector{
|
return &meminfoCollector{
|
||||||
config: config,
|
|
||||||
metrics: map[string]prometheus.Gauge{},
|
metrics: map[string]prometheus.Gauge{},
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,6 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type netDevCollector struct {
|
type netDevCollector struct {
|
||||||
config Config
|
|
||||||
metrics map[string]*prometheus.CounterVec
|
metrics map[string]*prometheus.CounterVec
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -32,11 +31,9 @@ func init() {
|
|||||||
Factories["netdev"] = NewNetDevCollector
|
Factories["netdev"] = NewNetDevCollector
|
||||||
}
|
}
|
||||||
|
|
||||||
// Takes a config struct and prometheus registry and returns a new Collector exposing
|
|
||||||
// network device stats.
|
// network device stats.
|
||||||
func NewNetDevCollector(config Config) (Collector, error) {
|
func NewNetDevCollector() (Collector, error) {
|
||||||
return &netDevCollector{
|
return &netDevCollector{
|
||||||
config: config,
|
|
||||||
metrics: map[string]*prometheus.CounterVec{},
|
metrics: map[string]*prometheus.CounterVec{},
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user