Collect at every scrape, rather than at regular intervals.

Switch to Update using the Collecter Collect interface, due to not knowing all
metricnames in all modules beforehand we can't use Describe and thus the full
Collecter interface.

Remove 'updates', it's meaning varies by module and doesn't add much.
This commit is contained in:
Brian Brazil 2014-10-29 14:16:43 +00:00
commit 1c17481a42
17 changed files with 193 additions and 286 deletions

View file

@ -1,6 +1,10 @@
// Exporter is a prometheus exporter using multiple Factories to collect and export system metrics.
package collector
import (
"github.com/prometheus/client_golang/prometheus"
)
const Namespace = "node"
var Factories = make(map[string]func(Config) (Collector, error))
@ -8,7 +12,7 @@ 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)
Update(ch chan<- prometheus.Metric) (err error)
}
// TODO: Instead of periodically call Update, a Collector could be implemented