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 2a09e25 commit b71c0f7
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lg.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@ var (

func (p *Prefix) checkLGState() {
log.Trace().Str("Prefix", p.prefix).Msg("checking prefix state")
upstreamsGauge.Reset()
upstreams2Gauge.Reset()
url := ripestatBase + "/data/looking-glass/data.json?resource=" + p.prefix + "&sourceapp=" + appId
resp, err := http.Get(url)
if err != nil {
Expand Down Expand Up @@ -151,6 +149,7 @@ func (p *Prefix) checkLGState() {
communities = append(communities, peer.Community)
}

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

upstreams2Gauge.Reset()
upstreams2Gauge.WithLabelValues(
p.prefix,
p.pop,
Expand All @@ -167,6 +167,7 @@ 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 b71c0f7

Please sign in to comment.