Fix build info metric

Use the new version collector to expose the `alertmanager_build_info`
metric. This fixes an incorrect deprecation migration done in #3806.

Signed-off-by: SuperQ <superq@gmail.com>
This commit is contained in:
SuperQ 2024-12-18 16:17:21 +01:00
parent 0d28327dd2
commit ef79cbd801
No known key found for this signature in database
GPG Key ID: C646B23C9E3245F1

View File

@ -33,7 +33,7 @@ import (
"github.com/KimMachineGun/automemlimit/memlimit"
"github.com/alecthomas/kingpin/v2"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/collectors"
versioncollector "github.com/prometheus/client_golang/prometheus/collectors/version"
"github.com/prometheus/client_golang/prometheus/promhttp"
"github.com/prometheus/common/model"
"github.com/prometheus/common/promslog"
@ -116,7 +116,7 @@ func init() {
prometheus.MustRegister(configuredReceivers)
prometheus.MustRegister(configuredIntegrations)
prometheus.MustRegister(configuredInhibitionRules)
prometheus.MustRegister(collectors.NewBuildInfoCollector())
prometheus.MustRegister(versioncollector.NewCollector("alertmanager"))
}
func instrumentHandler(handlerName string, handler http.HandlerFunc) http.HandlerFunc {