From a233aaa66ef44af5f8397e47edefe2efe2cfbf50 Mon Sep 17 00:00:00 2001 From: Oliver Date: Sun, 9 May 2021 22:06:33 -0400 Subject: [PATCH] don't rely on stats code for new metrics if we can avoid it --- internal/server/metrics.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/internal/server/metrics.go b/internal/server/metrics.go index 7c184b02..a3164a5a 100644 --- a/internal/server/metrics.go +++ b/internal/server/metrics.go @@ -3,6 +3,8 @@ package server import ( "net/http" + "github.com/tidwall/tile38/core" + "github.com/prometheus/client_golang/prometheus" "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 */ @@ -110,9 +117,4 @@ func (s *Server) Collect(ch chan<- prometheus.Metric) { ) return true }) - - ch <- prometheus.MustNewConstMetric( - metricDescriptions["server_info"], - prometheus.GaugeValue, 1.0, m["id"].(string), m["version"].(string), - ) }