Commit Graph

6 Commits

Author SHA1 Message Date
f2e714dce5 chore: update module name 2021-12-05 09:28:25 +00:00
Dominic Evans
ef3ac24b07 chore: gofmt/goimports 2021-05-13 10:19:35 +01:00
Dominic Evans
10827cf62e fix: add /metrics handler and stop logging 2021-05-13 10:11:32 +01:00
Dominic Evans
baf88bdc78 fix: reset gauge in-between collect() calls
It looks like in the `collect()` loop the `dsl_status` gauge is latched to 1 with the current status label set
```go
c.status.WithLabelValues(
    c.host, c.identifier, status.DSLCfg.Status, status.DSLCfg.Modulation, status.DSLCfg.DataPath).Set(1)
```

However, this means that all historically seen statuses are latched to 1 and never reset to 0:
```
dsl_status{dataPath="",host="192.168.2.1",identifier="BT",modulation="",status="EstablishingLink"} 1
dsl_status{dataPath="",host="192.168.2.1",identifier="BT",modulation="",status="Initializing"} 1
dsl_status{dataPath="",host="192.168.2.1",identifier="BT",modulation="",status="NoSignal"} 1
```

Ideally in the `collect()` loop it would loop over all known status
values and set them to 0 for the ongoing publishes when the status has
changed. However, as a simpler workaround in this commit we just call
`.Reset()` on the gauge before the call to `.Set(1)` and that stops
publishing the metric label for the old statuses
2020-07-03 11:24:12 +00:00
Jake Keeys
542060a14b adds identifier 2020-01-26 13:23:26 +00:00
Jake Keeys
f5de88e5bb init 2020-01-26 12:35:46 +00:00