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