Skip to content

Commit

Permalink
update timer
Browse files Browse the repository at this point in the history
  • Loading branch information
ezrizhu committed Nov 14, 2024
1 parent c8ae698 commit 73cd3c7
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ import (
"github.com/rs/zerolog"
"github.com/rs/zerolog/log"

"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promauto"
"github.com/prometheus/client_golang/prometheus/promhttp"
)

Expand All @@ -25,7 +27,15 @@ var jsonLog bool

const ripestatBase = "https://stat.ripe.net"

var (
updateDuration = promauto.NewGauge(prometheus.GaugeOpts{
Name: "update_duration",
Help: "time it takes for update to finish",
})
)

func updateStates() {
start := time.Now()
log.Debug().Msg("Updating Prefixes")

upstreamsGauge.Reset()
Expand All @@ -46,6 +56,8 @@ func updateStates() {
}()
}
wg.Wait()
elapsed := time.Since(start)
updateDuration.Set(elapsed.Seconds())
}

func init() {
Expand Down

0 comments on commit 73cd3c7

Please sign in to comment.