WIP: Morph: Add unit tests #2

Closed
dstepanov-yadro wants to merge 233 commits from TrueCloudLab/frostfs-node:master into object-3608-morph-unit-tests
5 changed files with 11 additions and 11 deletions
Showing only changes of commit 847732605c - Show all commits

View file

@ -43,14 +43,14 @@ func newEngineMetrics() *engineMetrics {
return &engineMetrics{ return &engineMetrics{
containerSize: newEngineGaugeVector("container_size_bytes", "Accumulated size of all objects in a container", []string{containerIDLabelKey}), 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}), 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{ methodDuration: metrics.NewHistogramVec(prometheus.HistogramOpts{
Namespace: namespace, Namespace: namespace,
Subsystem: engineSubsystem, Subsystem: engineSubsystem,
Name: "request_duration_seconds", Name: "request_duration_seconds",
Help: "Duration of Engine requests", Help: "Duration of Engine requests",
}, []string{engineMethod}), }, []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}), shardsReadonly: newEngineGaugeVector("mode", "Shard mode", []string{shardIDLabelKey}),
gc: newGCMetrics(), gc: newGCMetrics(),
writeCache: newWriteCacheMetrics(), writeCache: newWriteCacheMetrics(),

View file

@ -43,7 +43,7 @@ func newGCMetrics() *gcMetrics {
deletedCounter: metrics.NewCounterVec(prometheus.CounterOpts{ deletedCounter: metrics.NewCounterVec(prometheus.CounterOpts{
Namespace: namespace, Namespace: namespace,
Subsystem: gcSubsystem, Subsystem: gcSubsystem,
Name: "deleted_objects_count", Name: "deleted_objects_total",
Help: "Total count of objects GC deleted or failed to delete from disk", Help: "Total count of objects GC deleted or failed to delete from disk",
}, []string{gcShardID, gcStatus}), }, []string{gcShardID, gcStatus}),
expCollectDuration: metrics.NewCounterVec(prometheus.CounterOpts{ expCollectDuration: metrics.NewCounterVec(prometheus.CounterOpts{
@ -55,7 +55,7 @@ func newGCMetrics() *gcMetrics {
inhumedCounter: metrics.NewCounterVec(prometheus.CounterOpts{ inhumedCounter: metrics.NewCounterVec(prometheus.CounterOpts{
Namespace: namespace, Namespace: namespace,
Subsystem: gcSubsystem, Subsystem: gcSubsystem,
Name: "marked_for_removal_objects_count", Name: "marked_for_removal_objects_total",
Help: "Total count of expired objects GC marked to remove", Help: "Total count of expired objects GC marked to remove",
}, []string{gcShardID, gcObjectType}), }, []string{gcShardID, gcObjectType}),
} }

View file

@ -30,7 +30,7 @@ func NewMorphClientMetrics() morphmetrics.Register {
switchCount: metrics.NewCounter(prometheus.CounterOpts{ switchCount: metrics.NewCounter(prometheus.CounterOpts{
Namespace: namespace, Namespace: namespace,
Subsystem: morphSubsystem, Subsystem: morphSubsystem,
Name: "switch_count", Name: "switches_total",
Help: "Number of endpoint switches", Help: "Number of endpoint switches",
}), }),
lastBlock: metrics.NewGauge(prometheus.GaugeOpts{ lastBlock: metrics.NewGauge(prometheus.GaugeOpts{
@ -42,7 +42,7 @@ func NewMorphClientMetrics() morphmetrics.Register {
notificationCount: metrics.NewCounterVec(prometheus.CounterOpts{ notificationCount: metrics.NewCounterVec(prometheus.CounterOpts{
Namespace: namespace, Namespace: namespace,
Subsystem: morphSubsystem, Subsystem: morphSubsystem,
Name: "notification_count", Name: "notifications_total",
Help: "Number of notifications received by notification type", Help: "Number of notifications received by notification type",
}, []string{morphNotificationTypeLabel}), }, []string{morphNotificationTypeLabel}),
invokeDuration: metrics.NewHistogramVec(prometheus.HistogramOpts{ invokeDuration: metrics.NewHistogramVec(prometheus.HistogramOpts{

View file

@ -40,9 +40,9 @@ func (m *replicatorMetrics) AddPayloadSize(size int64) {
func newReplicatorMetrics() *replicatorMetrics { func newReplicatorMetrics() *replicatorMetrics {
return &replicatorMetrics{ return &replicatorMetrics{
inFlightRequests: newReplicatorGauge("in_flight_requests", "Number of in-flight requests"), inFlightRequests: newReplicatorGauge("in_flight_requests_total", "Number of in-flight requests"),
processedObjects: newReplicatorCounter("processed_objects", "Number of objects processed since the node startup"), processedObjects: newReplicatorCounter("processed_objects_total", "Number of objects processed since the node startup"),
totalReplicatedPayloadSize: newReplicatorCounter("total_replicated_payload_size", "Total size of payloads replicated"), totalReplicatedPayloadSize: newReplicatorCounter("total_replicated_payload_size_bytes", "Total size of payloads replicated"),
} }
} }

View file

@ -62,10 +62,10 @@ func newWriteCacheMetrics() *writeCacheMetrics {
operationCounter: metrics.NewCounterVec(prometheus.CounterOpts{ operationCounter: metrics.NewCounterVec(prometheus.CounterOpts{
Namespace: namespace, Namespace: namespace,
Subsystem: wcSubsystem, Subsystem: wcSubsystem,
Name: "operation_count", Name: "operations_total",
Help: "The number of writecache operations processed", Help: "The number of writecache operations processed",
}, []string{wcShardID, wcStorage, wcSuccess, wcOperation}), }, []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}), estimatedSize: newWCGaugeVec("estimated_size_bytes", "Estimated writecache size", []string{wcShardID, wcStorage}),
modeMtx: sync.RWMutex{}, modeMtx: sync.RWMutex{},
modeMetrics: make(map[shardIDMode]prometheus.GaugeFunc), modeMetrics: make(map[shardIDMode]prometheus.GaugeFunc),