Skip to content

Commit

Permalink
Debugging: Take out metrics filter.
Browse files Browse the repository at this point in the history
  • Loading branch information
Gerrit91 committed Apr 7, 2022
1 parent 4885c78 commit 238ff47
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
20 changes: 10 additions & 10 deletions cmd/metal-api/internal/metrics/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
)

var (
machineLiveliness = prometheus.NewGaugeVec(
machineLiveliness = prometheus.NewGaugeVec( //nolint
prometheus.GaugeOpts{
Namespace: "metal",
Subsystem: "machine",
Expand Down Expand Up @@ -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.
Expand All @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion cmd/metal-api/internal/service/machine-service.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion cmd/metal-api/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down

0 comments on commit 238ff47

Please sign in to comment.