diff --git a/cmd/metal-api/internal/metrics/metrics.go b/cmd/metal-api/internal/metrics/metrics.go index a9c485eb8..e28bc5bd5 100644 --- a/cmd/metal-api/internal/metrics/metrics.go +++ b/cmd/metal-api/internal/metrics/metrics.go @@ -9,7 +9,7 @@ import ( ) var ( - machineLiveliness = prometheus.NewGaugeVec( + machineLiveliness = prometheus.NewGaugeVec( //nolint prometheus.GaugeOpts{ Namespace: "metal", Subsystem: "machine", @@ -41,7 +41,7 @@ var ( ) func init() { - prometheus.MustRegister(machineLiveliness, counter, duration) + // prometheus.MustRegister(machineLiveliness, counter, duration) } // PartitionLiveliness is a data container for the liveliness of different partitions. @@ -51,14 +51,14 @@ type PartitionLiveliness map[string]struct { Unknown int } -// ProvideLiveliness provides the given values as gauges so a scraper can collect them. -func ProvideLiveliness(lvness PartitionLiveliness) { - for p, l := range lvness { - machineLiveliness.WithLabelValues(p, "alive").Set(float64(l.Alive)) - machineLiveliness.WithLabelValues(p, "dead").Set(float64(l.Dead)) - machineLiveliness.WithLabelValues(p, "unknown").Set(float64(l.Unknown)) - } -} +// // ProvideLiveliness provides the given values as gauges so a scraper can collect them. +// func ProvideLiveliness(lvness PartitionLiveliness) { +// for p, l := range lvness { +// machineLiveliness.WithLabelValues(p, "alive").Set(float64(l.Alive)) +// machineLiveliness.WithLabelValues(p, "dead").Set(float64(l.Dead)) +// machineLiveliness.WithLabelValues(p, "unknown").Set(float64(l.Unknown)) +// } +// } func RestfulMetrics(req *restful.Request, resp *restful.Response, chain *restful.FilterChain) { n := time.Now() diff --git a/cmd/metal-api/internal/service/machine-service.go b/cmd/metal-api/internal/service/machine-service.go index 1140cf8fe..bc3205026 100644 --- a/cmd/metal-api/internal/service/machine-service.go +++ b/cmd/metal-api/internal/service/machine-service.go @@ -2189,7 +2189,7 @@ func MachineLiveliness(ctx context.Context, ds *datastore.RethinkStore, logger * liveliness[m.PartitionID] = p } - metrics.ProvideLiveliness(liveliness) + // metrics.ProvideLiveliness(liveliness) logger.Infow("machine liveliness evaluated", "alive", alive, "dead", dead, "unknown", unknown, "errors", errs) diff --git a/cmd/metal-api/main.go b/cmd/metal-api/main.go index 44945f4bc..d8264663d 100644 --- a/cmd/metal-api/main.go +++ b/cmd/metal-api/main.go @@ -14,13 +14,13 @@ import ( "time" v1 "github.com/metal-stack/masterdata-api/api/v1" + "github.com/metal-stack/metal-api/cmd/metal-api/internal/metrics" "github.com/metal-stack/metal-api/cmd/metal-api/internal/service/s3client" "google.golang.org/protobuf/types/known/wrapperspb" "github.com/go-logr/zapr" "github.com/metal-stack/metal-api/cmd/metal-api/internal/grpc" - "github.com/metal-stack/metal-api/cmd/metal-api/internal/metrics" "github.com/metal-stack/metal-lib/rest" "github.com/prometheus/client_golang/prometheus/promhttp"