Skip to content

Commit

Permalink
fix dupe upstreams
Browse files Browse the repository at this point in the history
  • Loading branch information
ezrizhu committed Jul 22, 2024
1 parent 3bd2f44 commit 343db33
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions lg.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,26 +74,28 @@ func (p *PrefixState) checkLGState() {
log.Err(err).Msg("atoi fail")
}
}
upstreams = append(upstreams, upstream)
if len(asPathSplit) >= 5 {
upstream2 = asPathSplit[len(asPathSplit)-5]
if err != nil {
log.Err(err).Msg("atoi fail")
}
}
upstreams2 = append(upstreams2, upstream2)
if !slices.Contains(upstreams, upstream) {
upstreams = append(upstreams, upstream)
}
if !slices.Contains(upstreams2, upstream2) {
upstreams2 = append(upstreams2, upstream2)
}
//communities = append(communities, peer.Community)
}

upstreams = slices.Compact(upstreams)
upstreamsGauge.WithLabelValues(
p.Prefix,
rrc.Location,
prefixes[p.Prefix],
strings.Join(upstreams, " "),
).Set(float64(len(upstreams)))

upstreams2 = slices.Compact(upstreams2)
upstreams2Gauge.WithLabelValues(
p.Prefix,
rrc.Location,
Expand Down

0 comments on commit 343db33

Please sign in to comment.