Skip to content

Commit

Permalink
Merge pull request #1107 from bosun-monitor/disableSelf
Browse files Browse the repository at this point in the history
cmd/scollector: scollector.* metrics disabled properly with DisableSelf
  • Loading branch information
maddyblue committed Jul 6, 2015
2 parents 8eabd7d + 9bbacca commit 45fa1a0
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions cmd/scollector/collectors/interval.go
Expand Up @@ -10,6 +10,7 @@ import (
"sync"
"time"

"bosun.org/collect"
"bosun.org/metadata"
"bosun.org/opentsdb"
"bosun.org/slog"
Expand Down Expand Up @@ -45,7 +46,7 @@ func (c *IntervalCollector) Run(dpchan chan<- *opentsdb.DataPoint) {
}
}()
}
tags := opentsdb.TagSet{"collector": c.Name(), "os": runtime.GOOS}

for {
interval := c.Interval
if interval == 0 {
Expand All @@ -61,8 +62,11 @@ func (c *IntervalCollector) Run(dpchan chan<- *opentsdb.DataPoint) {
slog.Errorf("%v: %v", c.Name(), err)
result = 1
}
Add(&md, "scollector.collector.duration", timeFinish.Seconds(), tags, metadata.Gauge, metadata.Second, "Duration in seconds for each collector run.")
Add(&md, "scollector.collector.error", result, tags, metadata.Gauge, metadata.Ok, "Status of collector run. 1=Error, 0=Success.")
if !collect.DisableDefaultCollectors {
tags := opentsdb.TagSet{"collector": c.Name(), "os": runtime.GOOS}
Add(&md, "scollector.collector.duration", timeFinish.Seconds(), tags, metadata.Gauge, metadata.Second, "Duration in seconds for each collector run.")
Add(&md, "scollector.collector.error", result, tags, metadata.Gauge, metadata.Ok, "Status of collector run. 1=Error, 0=Success.")
}
for _, dp := range md {
dpchan <- dp
}
Expand Down

0 comments on commit 45fa1a0

Please sign in to comment.