2021-03-15 13:09:27 +00:00
|
|
|
package engine
|
|
|
|
|
|
|
|
import (
|
|
|
|
"time"
|
|
|
|
)
|
|
|
|
|
2021-03-16 08:14:56 +00:00
|
|
|
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)
|
2022-08-19 16:49:09 +00:00
|
|
|
|
2022-09-09 11:37:35 +00:00
|
|
|
SetObjectCounter(shardID, objectType string, v uint64)
|
|
|
|
AddToObjectCounter(shardID, objectType string, delta int)
|
2021-03-15 13:09:27 +00:00
|
|
|
}
|
|
|
|
|
2021-03-16 08:14:56 +00:00
|
|
|
func elapsed(addFunc func(d time.Duration)) func() {
|
2021-03-15 13:09:27 +00:00
|
|
|
t := time.Now()
|
|
|
|
|
|
|
|
return func() {
|
2021-03-16 08:14:56 +00:00
|
|
|
addFunc(time.Since(t))
|
2021-03-15 13:09:27 +00:00
|
|
|
}
|
|
|
|
}
|