diff --git a/pkg/metrics/gc.go b/pkg/metrics/gc.go index 2457c0c6b2..9c00d8722d 100644 --- a/pkg/metrics/gc.go +++ b/pkg/metrics/gc.go @@ -1,7 +1,7 @@ package metrics import ( - "fmt" + "strconv" "time" "git.frostfs.info/TrueCloudLab/frostfs-observability/metrics" @@ -64,7 +64,7 @@ func newGCMetrics() *gcMetrics { func (m *gcMetrics) AddRunDuration(shardID string, d time.Duration, success bool) { m.runDuration.With(prometheus.Labels{ gcShardID: shardID, - gcSuccess: fmt.Sprintf("%v", success), + gcSuccess: strconv.FormatBool(success), }).Add(d.Seconds()) } @@ -84,7 +84,7 @@ func (m *gcMetrics) AddDeletedCount(shardID string, deleted, failed uint64) { func (m *gcMetrics) AddExpiredObjectCollectionDuration(shardID string, d time.Duration, success bool, objectType string) { m.expCollectDuration.With(prometheus.Labels{ gcShardID: shardID, - gcSuccess: fmt.Sprintf("%v", success), + gcSuccess: strconv.FormatBool(success), gcObjectType: objectType, }).Add(d.Seconds()) } diff --git a/pkg/metrics/morphcache.go b/pkg/metrics/morphcache.go index 7f6f2d7d5c..2440adcfb2 100644 --- a/pkg/metrics/morphcache.go +++ b/pkg/metrics/morphcache.go @@ -2,6 +2,7 @@ package metrics import ( "fmt" + "strconv" "time" "git.frostfs.info/TrueCloudLab/frostfs-observability/metrics" @@ -46,7 +47,7 @@ func newMorphCacheMetrics() *morphCacheMetrics { func (m *morphCacheMetrics) AddNNSContractHashDuration(success bool, d time.Duration) { m.nnsContractHashDuration.With( prometheus.Labels{ - mcSuccess: fmt.Sprintf("%v", success), + mcSuccess: strconv.FormatBool(success), }, ).Observe(float64(d)) } @@ -54,7 +55,7 @@ func (m *morphCacheMetrics) AddNNSContractHashDuration(success bool, d time.Dura func (m *morphCacheMetrics) AddGroupKeyDuration(success bool, d time.Duration) { m.groupKeyDuration.With( prometheus.Labels{ - mcSuccess: fmt.Sprintf("%v", success), + mcSuccess: strconv.FormatBool(success), }, ).Observe(float64(d)) } @@ -62,7 +63,7 @@ func (m *morphCacheMetrics) AddGroupKeyDuration(success bool, d time.Duration) { func (m *morphCacheMetrics) AddTxHeightDuration(hash util.Uint256, success bool, d time.Duration) { m.txHeightDuration.With( prometheus.Labels{ - mcSuccess: fmt.Sprintf("%v", success), + mcSuccess: strconv.FormatBool(success), }, ).Observe(float64(d)) } diff --git a/pkg/metrics/treeservice.go b/pkg/metrics/treeservice.go index 48a450c76b..ae24c41b29 100644 --- a/pkg/metrics/treeservice.go +++ b/pkg/metrics/treeservice.go @@ -1,7 +1,7 @@ package metrics import ( - "fmt" + "strconv" "time" "git.frostfs.info/TrueCloudLab/frostfs-observability/metrics" @@ -50,18 +50,18 @@ func newTreeServiceMetrics() *treeServiceMetrics { func (m *treeServiceMetrics) AddReplicateTaskDuration(d time.Duration, success bool) { m.replicateTaskDuration.With(prometheus.Labels{ - treeServiceLabelSuccess: fmt.Sprintf("%v", success), + treeServiceLabelSuccess: strconv.FormatBool(success), }).Observe(d.Seconds()) } func (m *treeServiceMetrics) AddReplicateWaitDuration(d time.Duration, success bool) { m.replicateWaitDuration.With(prometheus.Labels{ - treeServiceLabelSuccess: fmt.Sprintf("%v", success), + treeServiceLabelSuccess: strconv.FormatBool(success), }).Observe(d.Seconds()) } func (m *treeServiceMetrics) AddSyncDuration(d time.Duration, success bool) { m.syncOpDuration.With(prometheus.Labels{ - treeServiceLabelSuccess: fmt.Sprintf("%v", success), + treeServiceLabelSuccess: strconv.FormatBool(success), }).Observe(d.Seconds()) } diff --git a/pkg/metrics/writecache.go b/pkg/metrics/writecache.go index 67b9d8caff..b27e684d5d 100644 --- a/pkg/metrics/writecache.go +++ b/pkg/metrics/writecache.go @@ -2,6 +2,7 @@ package metrics import ( "fmt" + "strconv" "sync" "time" @@ -148,7 +149,7 @@ func (m *writeCacheMetrics) SetMode(shardID string, mode string) { func (m *writeCacheMetrics) IncFlushCounter(shardID string, success bool, storageType string) { m.flushCounter.With(prometheus.Labels{ wcShardID: shardID, - wcSuccess: fmt.Sprintf("%v", success), + wcSuccess: strconv.FormatBool(success), wcStorage: storageType, }).Inc() } @@ -164,7 +165,7 @@ func setWriteCacheDuration(m *prometheus.HistogramVec, shardID string, success b m.With( prometheus.Labels{ wcShardID: shardID, - wcSuccess: fmt.Sprintf("%v", success), + wcSuccess: strconv.FormatBool(success), wcStorage: storageType, }, ).Observe(d.Seconds())