giantswarm / prometheus-pingdom-exporter

prometheus-pingdom-exporter exports Pingdom metrics to Prometheus
https://giantswarm.io
Apache License 2.0
50 stars 46 forks source link

duplicate check status #16

Open freeseacher opened 6 years ago

freeseacher commented 6 years ago

Hi. I've build that exporter from master branch to achieve multiuser functionally and seems found a bug.

If check was modified anyhow exporter began to export each variant of check. For example

pingdom_check_status{hostname="XXX",id="XXX7",name="Internal check",paused="false",resolution="1",tags="proxy,releng-internal"} 0
pingdom_check_status{hostname="XXX",id="XXX7",name="Internal check",paused="false",resolution="1",tags="proxy,internal"} 0

Id remains the same. after restarting exporter all seems back to normal

freeseacher commented 6 years ago

Same behaviour with changing pause status. As a result i got 6 different checks. 2 with first tag list, 2 with second tag list and 2 with paused/unpaused state.

freeseacher commented 6 years ago
*** go/src/github.com/giantswarm/prometheus-pingdom-exporter/cmd/server.go  2018-09-13 00:59:40.360763474 +0300
--- go/src/github.com/freeseacher/prometheus-pingdom-exporter/cmd/server.go 2018-09-13 00:44:14.383017753 +0300
*************** func serverRun(cmd *cobra.Command, args
*** 95,102 ****
            }
            pingdomUp.Set(1)

-           pingdomCheckResponseTime.Reset()
-           pingdomCheckStatus.Reset()
            for _, check := range checks {
                id := strconv.Itoa(check.ID)

--- 95,100 ----

It seems something like that will fix duplication. But i am not sure if i use right place to reset metrics

giddel commented 6 years ago

Same behavior here. After renaming a check in Pingdom I get two checks with the old and the new name. Can anyone fix this please?

giddel commented 5 years ago

Is there anyone who would fix this. Its really annoying!

giddel commented 5 years ago

As described in: https://github.com/prometheus/client_golang/blob/da11cf2c83c7414b76736025847c1cbdbb41e11e/prometheus/gauge.go#L159

// GetMetricWithLabelValues returns the Gauge for the given slice of label
// values (same order as the VariableLabels in Desc). If that combination of
// label values is accessed for the first time, a new Gauge is created.

Maybe It is be better to select the gauge by only the "id" label first (I assume the id is unique in Pingdom) and update set the other label / values and the metrics value explizit only on this single gauge.

???

cryptobioz commented 5 years ago

The PR #20 should fix this issue. /cc @giddel @freeseacher @JosephSalisbury