don't rely on stats code for new metrics if we can avoid it

This commit is contained in:
Oliver 2021-05-09 22:06:33 -04:00 committed by tidwall
parent 5b3aeb5db7
commit a233aaa66e
1 changed files with 7 additions and 5 deletions

View File

@ -3,6 +3,8 @@ package server
import ( import (
"net/http" "net/http"
"github.com/tidwall/tile38/core"
"github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promhttp" "github.com/prometheus/client_golang/prometheus/promhttp"
) )
@ -79,6 +81,11 @@ func (s *Server) Collect(ch chan<- prometheus.Metric) {
} }
} }
ch <- prometheus.MustNewConstMetric(
metricDescriptions["server_info"],
prometheus.GaugeValue, 1.0, s.config.serverID(), core.Version,
)
/* /*
add stats per collection add stats per collection
*/ */
@ -110,9 +117,4 @@ func (s *Server) Collect(ch chan<- prometheus.Metric) {
) )
return true return true
}) })
ch <- prometheus.MustNewConstMetric(
metricDescriptions["server_info"],
prometheus.GaugeValue, 1.0, m["id"].(string), m["version"].(string),
)
} }