[#1658] engine: Update metrics interfaces
It now supports typed object counter metrics. Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
This commit is contained in:
parent
175e2b9fa0
commit
edef26a4fd
2 changed files with 10 additions and 10 deletions
|
@ -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() {
|
||||
|
|
|
@ -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.
|
||||
|
|
Loading…
Reference in a new issue