[#373] metrics: Move labels to consts

To unify label naming all lable keys and other consts are moved to
one file.

Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
Dmitrii Stepanov 2023-06-16 10:13:22 +03:00
parent b5d9f4a285
commit 03aa210145
13 changed files with 119 additions and 160 deletions

View file

@ -8,13 +8,6 @@ import (
"github.com/prometheus/client_golang/prometheus"
)
const (
innerRingSubsystem = "ir"
innerRingLabelSuccess = "success"
innerRingLabelType = "type"
innerRingNamespace = "frostfs_ir"
)
// InnerRingServiceMetrics contains metrics collected by inner ring.
type InnerRingServiceMetrics struct {
epoch prometheus.Gauge
@ -43,7 +36,7 @@ func NewInnerRingMetrics() *InnerRingServiceMetrics {
Subsystem: innerRingSubsystem,
Name: "event_duration_seconds",
Help: "Duration of processing of inner-ring events",
}, []string{innerRingLabelType, innerRingLabelSuccess})
}, []string{typeLabel, successLabel})
)
return &InnerRingServiceMetrics{
@ -66,8 +59,8 @@ func (m *InnerRingServiceMetrics) SetHealth(s int32) {
func (m *InnerRingServiceMetrics) AddEvent(d time.Duration, typ string, success bool) {
m.eventDuration.With(prometheus.Labels{
innerRingLabelType: typ,
innerRingLabelSuccess: strconv.FormatBool(success),
typeLabel: typ,
successLabel: strconv.FormatBool(success),
}).Observe(d.Seconds())
}