diff --git a/exporter.go b/exporter.go index 99c48c9..e7b133a 100644 --- a/exporter.go +++ b/exporter.go @@ -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 {