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:
parent
5c15c86f77
commit
1c17481a42
17 changed files with 193 additions and 286 deletions
|
|
@ -32,16 +32,13 @@ func NewTimeCollector(config Config) (Collector, error) {
|
|||
config: config,
|
||||
}
|
||||
|
||||
if _, err := prometheus.RegisterOrGet(systemTime); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &c, nil
|
||||
}
|
||||
|
||||
func (c *timeCollector) Update() (updates int, err error) {
|
||||
updates++
|
||||
func (c *timeCollector) Update(ch chan<- prometheus.Metric) (err error) {
|
||||
now := time.Now()
|
||||
glog.V(1).Infof("Set time: %f", now.Unix())
|
||||
systemTime.Set(float64(now.Unix()))
|
||||
return updates, err
|
||||
systemTime.Collect(ch)
|
||||
return err
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue