forked from TrueCloudLab/frostfs-node
[#424] metrics: Refactor engine metrics
Use histogram vector to measure request duration. Fix naming like in Prometheus best practice. Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
parent
c8023a9c8d
commit
1b364d8cf4
13 changed files with 46 additions and 122 deletions
|
@ -7,17 +7,7 @@ import (
|
|||
)
|
||||
|
||||
type MetricRegister interface {
|
||||
AddListContainersDuration(d time.Duration)
|
||||
AddEstimateContainerSizeDuration(d time.Duration)
|
||||
AddDeleteDuration(d time.Duration)
|
||||
AddExistsDuration(d time.Duration)
|
||||
AddGetDuration(d time.Duration)
|
||||
AddHeadDuration(d time.Duration)
|
||||
AddInhumeDuration(d time.Duration)
|
||||
AddPutDuration(d time.Duration)
|
||||
AddRangeDuration(d time.Duration)
|
||||
AddSearchDuration(d time.Duration)
|
||||
AddListObjectsDuration(d time.Duration)
|
||||
AddMethodDuration(method string, d time.Duration)
|
||||
|
||||
SetObjectCounter(shardID, objectType string, v uint64)
|
||||
AddToObjectCounter(shardID, objectType string, delta int)
|
||||
|
@ -28,17 +18,17 @@ type MetricRegister interface {
|
|||
AddToPayloadCounter(shardID string, size int64)
|
||||
IncErrorCounter(shardID string)
|
||||
ClearErrorCounter(shardID string)
|
||||
DeleteErrorCounter(shardID string)
|
||||
DeleteShardMetrics(shardID string)
|
||||
|
||||
WriteCache() metrics.WriteCacheMetrics
|
||||
GC() metrics.GCMetrics
|
||||
}
|
||||
|
||||
func elapsed(addFunc func(d time.Duration)) func() {
|
||||
func elapsed(method string, addFunc func(method string, d time.Duration)) func() {
|
||||
t := time.Now()
|
||||
|
||||
return func() {
|
||||
addFunc(time.Since(t))
|
||||
addFunc(method, time.Since(t))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue