Skip to content
This repository has been archived by the owner on Apr 29, 2020. It is now read-only.

Commit

Permalink
Unregister metrics when stopping monitoring them
Browse files Browse the repository at this point in the history
  • Loading branch information
mcpherrinm committed Dec 6, 2019
1 parent 2320a90 commit 6cce7f4
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions pkg/ds/farm.go
Original file line number Diff line number Diff line change
Expand Up @@ -580,6 +580,18 @@ func (dsf *Farm) spawnDaemonSet(
for {
select {
case <-ctx.Done():
for _, name := range ds.MetricNames("healthy") {
p2metrics.Registry.Unregister(name)
}
for _, name := range ds.MetricNames("critical") {
p2metrics.Registry.Unregister(name)
}
for _, name := range ds.MetricNames("unknown") {
p2metrics.Registry.Unregister(name)
}
for _, name := range ds.MetricNames("warning") {
p2metrics.Registry.Unregister(name)
}
return
case <-ticks.C:
eligible, err := ds.EligibleNodes()
Expand Down

0 comments on commit 6cce7f4

Please sign in to comment.