Skip to content

Commit

Permalink
reset gauge
Browse files Browse the repository at this point in the history
  • Loading branch information
ezrizhu committed Oct 17, 2024
1 parent b71c0f7 commit baa1133
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lg.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ func (p *Prefix) checkLGState() {
availableStr = "n"
}

upstreamsGauge.Reset()
upstreams2Gauge.Reset()
bgpCommunitiesGauge.Reset()

origin := strconv.Itoa(p.origin)

for _, rrc := range ripeStatLookingGlassResp.Data.Rrcs {
Expand Down Expand Up @@ -149,7 +153,6 @@ func (p *Prefix) checkLGState() {
communities = append(communities, peer.Community)
}

upstreamsGauge.Reset()
upstreamsGauge.WithLabelValues(
p.prefix,
p.pop,
Expand All @@ -158,7 +161,6 @@ func (p *Prefix) checkLGState() {
origin,
).Set(float64(len(upstreams)))

upstreams2Gauge.Reset()
upstreams2Gauge.WithLabelValues(
p.prefix,
p.pop,
Expand All @@ -167,7 +169,6 @@ func (p *Prefix) checkLGState() {
origin,
).Set(float64(len(upstreams2)))

bgpCommunitiesGauge.Reset()
communities = slices.Compact(communities)
for _, e := range communities {
bgpCommunitiesGauge.WithLabelValues(
Expand Down

0 comments on commit baa1133

Please sign in to comment.