forked from TrueCloudLab/frostfs-node
[#442] Use strconv.FormatBool instead of untyped conversion
Signed-off-by: Alejandro Lopez <a.lopez@yadro.com>
This commit is contained in:
parent
4887f489a1
commit
0f269af40d
4 changed files with 14 additions and 12 deletions
|
@ -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())
|
||||
}
|
||||
|
|
|
@ -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))
|
||||
}
|
||||
|
|
|
@ -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())
|
||||
}
|
||||
|
|
|
@ -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())
|
||||
|
|
Loading…
Reference in a new issue