Skip to content

Commit

Permalink
Use common version for prometheus build_info
Browse files Browse the repository at this point in the history
  • Loading branch information
abh committed Jul 10, 2023
1 parent 49a0705 commit 3330769
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"github.com/abh/geodns/v3/monitor"
"github.com/abh/geodns/v3/querylog"
"github.com/abh/geodns/v3/zones"
"go.ntppool.org/common/version"
"golang.org/x/sync/errgroup"

"github.com/miekg/dns"
Expand Down Expand Up @@ -45,20 +46,21 @@ func NewServer(si *monitor.ServerInfo) *Server {
)
prometheus.MustRegister(queries)

buildInfo := prometheus.NewGaugeVec(
version.RegisterMetric("geodns", prometheus.DefaultRegisterer)

instanceInfo := prometheus.NewGaugeVec(
prometheus.GaugeOpts{
Name: "geodns_build_info",
Help: "GeoDNS build information (in labels)",
Name: "geodns_instance_info",
Help: "GeoDNS instance information",
},
[]string{"Version", "ID", "IP", "Group"},
[]string{"ID", "IP", "Group"},
)
prometheus.MustRegister(buildInfo)

prometheus.MustRegister(instanceInfo)
group := ""
if len(si.Groups) > 0 {
group = si.Groups[0]
}
buildInfo.WithLabelValues(si.Version, si.ID, si.IP, group).Set(1)
instanceInfo.WithLabelValues(si.ID, si.IP, group).Set(1)

startTime := prometheus.NewGauge(
prometheus.GaugeOpts{
Expand Down

0 comments on commit 3330769

Please sign in to comment.