From 847732605c025d6796dcb7923cccfe987cda6bbd Mon Sep 17 00:00:00 2001
From: Dmitrii Stepanov <d.stepanov@yadro.com>
Date: Wed, 14 Jun 2023 10:16:19 +0300
Subject: [PATCH] [#424] metrics: Rename counter to total

Suffix total should be used for a unit-less accumulating count.

Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
---
 pkg/metrics/engine.go     | 4 ++--
 pkg/metrics/gc.go         | 4 ++--
 pkg/metrics/morph.go      | 4 ++--
 pkg/metrics/replicator.go | 6 +++---
 pkg/metrics/writecache.go | 4 ++--
 5 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/pkg/metrics/engine.go b/pkg/metrics/engine.go
index 19e3591a6..d3f3238ac 100644
--- a/pkg/metrics/engine.go
+++ b/pkg/metrics/engine.go
@@ -43,14 +43,14 @@ func newEngineMetrics() *engineMetrics {
 	return &engineMetrics{
 		containerSize: newEngineGaugeVector("container_size_bytes", "Accumulated size of all objects in a container", []string{containerIDLabelKey}),
 		payloadSize:   newEngineGaugeVector("payload_size_bytes", "Accumulated size of all objects in a shard", []string{shardIDLabelKey}),
-		errorCounter:  newEngineGaugeVector("error_counter", "Shard's error counter", []string{shardIDLabelKey}),
+		errorCounter:  newEngineGaugeVector("errors_total", "Shard's error counter", []string{shardIDLabelKey}),
 		methodDuration: metrics.NewHistogramVec(prometheus.HistogramOpts{
 			Namespace: namespace,
 			Subsystem: engineSubsystem,
 			Name:      "request_duration_seconds",
 			Help:      "Duration of Engine requests",
 		}, []string{engineMethod}),
-		objectCounter:  newEngineGaugeVector("object_counter", "Objects counters per shards", []string{shardIDLabelKey, counterTypeLabelKey}),
+		objectCounter:  newEngineGaugeVector("objects_total", "Objects counters per shards", []string{shardIDLabelKey, counterTypeLabelKey}),
 		shardsReadonly: newEngineGaugeVector("mode", "Shard mode", []string{shardIDLabelKey}),
 		gc:             newGCMetrics(),
 		writeCache:     newWriteCacheMetrics(),
diff --git a/pkg/metrics/gc.go b/pkg/metrics/gc.go
index 9c00d8722..c0319562c 100644
--- a/pkg/metrics/gc.go
+++ b/pkg/metrics/gc.go
@@ -43,7 +43,7 @@ func newGCMetrics() *gcMetrics {
 		deletedCounter: metrics.NewCounterVec(prometheus.CounterOpts{
 			Namespace: namespace,
 			Subsystem: gcSubsystem,
-			Name:      "deleted_objects_count",
+			Name:      "deleted_objects_total",
 			Help:      "Total count of objects GC deleted or failed to delete from disk",
 		}, []string{gcShardID, gcStatus}),
 		expCollectDuration: metrics.NewCounterVec(prometheus.CounterOpts{
@@ -55,7 +55,7 @@ func newGCMetrics() *gcMetrics {
 		inhumedCounter: metrics.NewCounterVec(prometheus.CounterOpts{
 			Namespace: namespace,
 			Subsystem: gcSubsystem,
-			Name:      "marked_for_removal_objects_count",
+			Name:      "marked_for_removal_objects_total",
 			Help:      "Total count of expired objects GC marked to remove",
 		}, []string{gcShardID, gcObjectType}),
 	}
diff --git a/pkg/metrics/morph.go b/pkg/metrics/morph.go
index cc851d3db..cd5deb5e6 100644
--- a/pkg/metrics/morph.go
+++ b/pkg/metrics/morph.go
@@ -30,7 +30,7 @@ func NewMorphClientMetrics() morphmetrics.Register {
 		switchCount: metrics.NewCounter(prometheus.CounterOpts{
 			Namespace: namespace,
 			Subsystem: morphSubsystem,
-			Name:      "switch_count",
+			Name:      "switches_total",
 			Help:      "Number of endpoint switches",
 		}),
 		lastBlock: metrics.NewGauge(prometheus.GaugeOpts{
@@ -42,7 +42,7 @@ func NewMorphClientMetrics() morphmetrics.Register {
 		notificationCount: metrics.NewCounterVec(prometheus.CounterOpts{
 			Namespace: namespace,
 			Subsystem: morphSubsystem,
-			Name:      "notification_count",
+			Name:      "notifications_total",
 			Help:      "Number of notifications received by notification type",
 		}, []string{morphNotificationTypeLabel}),
 		invokeDuration: metrics.NewHistogramVec(prometheus.HistogramOpts{
diff --git a/pkg/metrics/replicator.go b/pkg/metrics/replicator.go
index dbcc67338..f16c296c6 100644
--- a/pkg/metrics/replicator.go
+++ b/pkg/metrics/replicator.go
@@ -40,9 +40,9 @@ func (m *replicatorMetrics) AddPayloadSize(size int64) {
 
 func newReplicatorMetrics() *replicatorMetrics {
 	return &replicatorMetrics{
-		inFlightRequests:           newReplicatorGauge("in_flight_requests", "Number of in-flight requests"),
-		processedObjects:           newReplicatorCounter("processed_objects", "Number of objects processed since the node startup"),
-		totalReplicatedPayloadSize: newReplicatorCounter("total_replicated_payload_size", "Total size of payloads replicated"),
+		inFlightRequests:           newReplicatorGauge("in_flight_requests_total", "Number of in-flight requests"),
+		processedObjects:           newReplicatorCounter("processed_objects_total", "Number of objects processed since the node startup"),
+		totalReplicatedPayloadSize: newReplicatorCounter("total_replicated_payload_size_bytes", "Total size of payloads replicated"),
 	}
 }
 
diff --git a/pkg/metrics/writecache.go b/pkg/metrics/writecache.go
index 31636a295..8498e3930 100644
--- a/pkg/metrics/writecache.go
+++ b/pkg/metrics/writecache.go
@@ -62,10 +62,10 @@ func newWriteCacheMetrics() *writeCacheMetrics {
 		operationCounter: metrics.NewCounterVec(prometheus.CounterOpts{
 			Namespace: namespace,
 			Subsystem: wcSubsystem,
-			Name:      "operation_count",
+			Name:      "operations_total",
 			Help:      "The number of writecache operations processed",
 		}, []string{wcShardID, wcStorage, wcSuccess, wcOperation}),
-		actualCount:   newWCGaugeVec("actual_objects_count", "Actual objects count in writecache", []string{wcShardID, wcStorage}),
+		actualCount:   newWCGaugeVec("actual_objects_total", "Actual objects count in writecache", []string{wcShardID, wcStorage}),
 		estimatedSize: newWCGaugeVec("estimated_size_bytes", "Estimated writecache size", []string{wcShardID, wcStorage}),
 		modeMtx:       sync.RWMutex{},
 		modeMetrics:   make(map[shardIDMode]prometheus.GaugeFunc),