-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Expand file tree
/
Copy pathcollector.go
More file actions
23 lines (18 loc) · 802 Bytes
/
collector.go
File metadata and controls
23 lines (18 loc) · 802 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// Exporter is a prometheus exporter using multiple Factories to collect and export system metrics.
package collector
const Namespace = "node"
var Factories = make(map[string]func(Config) (Collector, error))
// Interface a collector has to implement.
type Collector interface {
// Get new metrics and expose them via prometheus registry.
Update() (n int, err error)
}
// TODO: Instead of periodically call Update, a Collector could be implemented
// as a real prometheus.Collector that only gathers metrics when
// scraped. (However, for metric gathering that takes very long, it might
// actually be better to do them proactively before scraping to minimize scrape
// time.)
type Config struct {
Config map[string]string `json:"config"`
Attributes map[string]string `json:"attributes"`
}