Skip to content

Commit

Permalink
export site id
Browse files Browse the repository at this point in the history
  • Loading branch information
ezrizhu committed Sep 18, 2024
1 parent e9e9689 commit 2932140
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion cycle.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package main

import (
"strconv"

"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promauto"
)
Expand All @@ -11,14 +13,15 @@ var (
routesGauge = promauto.NewGaugeVec(prometheus.GaugeOpts{
Name: "current_announcements",
Help: "current announcements",
}, []string{"prefix", "site"})
}, []string{"prefix", "site", "id"})
)

func (p *Prefix) update(site *ConfigSite) {
if p.lastAdvSite != nil {
routesGauge.WithLabelValues(
p.prefix,
p.lastAdvSite.Name,
strconv.Itoa(p.lastAdvSite.Id),
).Set(0)
p.bgpWithdraw()
}
Expand All @@ -27,6 +30,7 @@ func (p *Prefix) update(site *ConfigSite) {
routesGauge.WithLabelValues(
p.prefix,
p.lastAdvSite.Name,
strconv.Itoa(p.lastAdvSite.Id),
).Set(1)

return
Expand Down

0 comments on commit 2932140

Please sign in to comment.