[#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)
|
AddSearchDuration(d time.Duration)
|
||||||
AddListObjectsDuration(d time.Duration)
|
AddListObjectsDuration(d time.Duration)
|
||||||
|
|
||||||
SetObjectCounter(shardID string, v uint64)
|
SetObjectCounter(shardID, objectType string, v uint64)
|
||||||
AddToObjectCounter(shardID string, delta int)
|
AddToObjectCounter(shardID, objectType string, delta int)
|
||||||
}
|
}
|
||||||
|
|
||||||
func elapsed(addFunc func(d time.Duration)) func() {
|
func elapsed(addFunc func(d time.Duration)) func() {
|
||||||
|
|
|
@ -22,20 +22,20 @@ type metricsWithID struct {
|
||||||
mw MetricRegister
|
mw MetricRegister
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m metricsWithID) SetObjectCounter(v uint64) {
|
func (m metricsWithID) SetObjectCounter(objectType string, v uint64) {
|
||||||
m.mw.SetObjectCounter(m.id, v)
|
m.mw.SetObjectCounter(m.id, objectType, v)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m metricsWithID) AddToObjectCounter(delta int) {
|
func (m metricsWithID) AddToObjectCounter(objectType string, delta int) {
|
||||||
m.mw.AddToObjectCounter(m.id, delta)
|
m.mw.AddToObjectCounter(m.id, objectType, delta)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m metricsWithID) IncObjectCounter() {
|
func (m metricsWithID) IncObjectCounter(objectType string) {
|
||||||
m.mw.AddToObjectCounter(m.id, +1)
|
m.mw.AddToObjectCounter(m.id, objectType, +1)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m metricsWithID) DecObjectCounter() {
|
func (m metricsWithID) DecObjectCounter(objectType string) {
|
||||||
m.mw.AddToObjectCounter(m.id, -1)
|
m.mw.AddToObjectCounter(m.id, objectType, -1)
|
||||||
}
|
}
|
||||||
|
|
||||||
// AddShard adds a new shard to the storage engine.
|
// AddShard adds a new shard to the storage engine.
|
||||||
|
|
Loading…
Reference in a new issue