Skip to content

Commit

Permalink
metrics name correct with standard (#319)
Browse files Browse the repository at this point in the history
prefix metrics
  • Loading branch information
ukff authored Jun 7, 2023
1 parent 6ab3640 commit a515070
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion internal/metrics/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ import (
"github.com/kyma-project/btp-manager/internal/conditions"
"github.com/prometheus/client_golang/prometheus"
"sigs.k8s.io/controller-runtime/pkg/metrics"
"strings"
)

const (
metricsNamespace = "btpmanager"
)

type Metrics struct {
Expand All @@ -14,7 +19,7 @@ func (m *Metrics) registerMetrics() {
m.ReasonCounters = make(map[conditions.Reason]prometheus.Counter, len(conditions.Reasons))
for reason, metadata := range conditions.Reasons {
counter := prometheus.NewCounter(prometheus.CounterOpts{
Name: string(reason),
Name: prometheus.BuildFQName(metricsNamespace, "", strings.ToLower(string(reason))),
ConstLabels: prometheus.Labels{"state": string(metadata.State)},
})
m.ReasonCounters[reason] = counter
Expand Down

0 comments on commit a515070

Please sign in to comment.