From edef26a4fd39f19ce6b9d80ddd0dea81e32a6e98 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Fri, 9 Sep 2022 14:37:35 +0300 Subject: [PATCH] [#1658] engine: Update metrics interfaces It now supports typed object counter metrics. Signed-off-by: Pavel Karpy --- pkg/local_object_storage/engine/metrics.go | 4 ++-- pkg/local_object_storage/engine/shards.go | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/pkg/local_object_storage/engine/metrics.go b/pkg/local_object_storage/engine/metrics.go index 98aacb77a..f9bb67d07 100644 --- a/pkg/local_object_storage/engine/metrics.go +++ b/pkg/local_object_storage/engine/metrics.go @@ -17,8 +17,8 @@ type MetricRegister interface { AddSearchDuration(d time.Duration) AddListObjectsDuration(d time.Duration) - SetObjectCounter(shardID string, v uint64) - AddToObjectCounter(shardID string, delta int) + SetObjectCounter(shardID, objectType string, v uint64) + AddToObjectCounter(shardID, objectType string, delta int) } func elapsed(addFunc func(d time.Duration)) func() { diff --git a/pkg/local_object_storage/engine/shards.go b/pkg/local_object_storage/engine/shards.go index d0a7fe0c1..636132444 100644 --- a/pkg/local_object_storage/engine/shards.go +++ b/pkg/local_object_storage/engine/shards.go @@ -22,20 +22,20 @@ type metricsWithID struct { mw MetricRegister } -func (m metricsWithID) SetObjectCounter(v uint64) { - m.mw.SetObjectCounter(m.id, v) +func (m metricsWithID) SetObjectCounter(objectType string, v uint64) { + m.mw.SetObjectCounter(m.id, objectType, v) } -func (m metricsWithID) AddToObjectCounter(delta int) { - m.mw.AddToObjectCounter(m.id, delta) +func (m metricsWithID) AddToObjectCounter(objectType string, delta int) { + m.mw.AddToObjectCounter(m.id, objectType, delta) } -func (m metricsWithID) IncObjectCounter() { - m.mw.AddToObjectCounter(m.id, +1) +func (m metricsWithID) IncObjectCounter(objectType string) { + m.mw.AddToObjectCounter(m.id, objectType, +1) } -func (m metricsWithID) DecObjectCounter() { - m.mw.AddToObjectCounter(m.id, -1) +func (m metricsWithID) DecObjectCounter(objectType string) { + m.mw.AddToObjectCounter(m.id, objectType, -1) } // AddShard adds a new shard to the storage engine.