From 74b3dcbcc42afbf5de3096755af1c544c3ad2eda Mon Sep 17 00:00:00 2001 From: Ezri Zhu Date: Thu, 14 Nov 2024 00:04:59 -0500 Subject: [PATCH] vis count --- lg.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/lg.go b/lg.go index a1fcccc..a76072f 100644 --- a/lg.go +++ b/lg.go @@ -40,6 +40,12 @@ var ( }, []string{"prefix", "city", "mux", "communities"}, ) + prefixCountGauge = promauto.NewGaugeVec(prometheus.GaugeOpts{ + Name: "prefix_count", + Help: "Prefix Count", + }, + []string{"prefix", "city", "mux"}, + ) ) func (p *Prefix) checkLGState() { @@ -77,6 +83,14 @@ func (p *Prefix) checkLGState() { origin := strconv.Itoa(p.origin) + for _, rrc := range ripeStatLookingGlassResp.Data.Rrcs { + prefixCountGauge.WithLabelValues( + p.prefix, + rrc.Location, + p.pop, + ).Set(float64(len(rrc.Peers))) + } + for _, rrc := range ripeStatLookingGlassResp.Data.Rrcs { //communities := []string{} for _, peer := range rrc.Peers {