Skip to content

Commit

Permalink
reset app gauges to omit old/removed apps
Browse files Browse the repository at this point in the history
  • Loading branch information
matt-deboer committed Nov 30, 2016
1 parent cad1a2c commit a864312
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,15 +135,15 @@ func (e *Exporter) scrapeApps(json *gabs.Container, ch chan<- prometheus.Metric)
"avg_uptime": "taskStats.startedAfterLastScaling.stats.lifeTime.averageSeconds",
}

name := "app_instances"
gauge, new := e.Gauges.Fetch(name, "Marathon app instance count", "app")
if new {
log.Infof("Added gauge %q\n", name)
}
gauge.Reset()

for _, app := range elements {
id := app.Path("id").Data().(string)
name := "app_instances"

gauge, new := e.Gauges.Fetch(name, "Marathon app instance count", "app")
if new {
log.Infof("Added gauge %q\n", name)
}

data := app.Path("instances").Data()
count, ok := data.(float64)
if !ok {
Expand Down

0 comments on commit a864312

Please sign in to comment.