From 5d298fa53ee4f4a015d5b1329a738d54fce13213 Mon Sep 17 00:00:00 2001 From: Ezri Zhu Date: Wed, 13 Nov 2024 22:54:44 -0500 Subject: [PATCH] fix exec flow of lg --- lg.go | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/lg.go b/lg.go index 8ce23ff..3ea7fac 100644 --- a/lg.go +++ b/lg.go @@ -77,6 +77,22 @@ func (p *Prefix) checkLGState() { origin := strconv.Itoa(p.origin) + for _, rrc := range ripeStatLookingGlassResp.Data.Rrcs { + communities := []string{} + for _, peer := range rrc.Peers { + communities = append(communities, peer.Community) + //communities = slices.Compact(communities) + for _, e := range communities { + bgpCommunitiesGauge.WithLabelValues( + p.prefix, + rrc.Location, + p.pop, + e, + ).Set(1) + } + } + } + for _, rrc := range ripeStatLookingGlassResp.Data.Rrcs { upstreams := []string{} upstreams2 := []string{} @@ -151,16 +167,6 @@ func (p *Prefix) checkLGState() { } } - //communities = slices.Compact(communities) - for _, e := range communities { - bgpCommunitiesGauge.WithLabelValues( - p.prefix, - rrc.Location, - p.pop, - e, - ).Set(1) - } - upstreamsGauge.WithLabelValues( p.prefix, p.pop,