forked from TrueCloudLab/frostfs-node
[#374] Add inner-ring event metrics
Signed-off-by: Alejandro Lopez <a.lopez@yadro.com>
This commit is contained in:
parent
8dcd06c587
commit
ebcc8afbee
27 changed files with 287 additions and 113 deletions
16
pkg/innerring/processors/util.go
Normal file
16
pkg/innerring/processors/util.go
Normal file
|
@ -0,0 +1,16 @@
|
|||
package processors
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/innerring/metrics"
|
||||
"github.com/panjf2000/ants/v2"
|
||||
)
|
||||
|
||||
func SubmitEvent(pool *ants.Pool, metrics metrics.Register, eventLabel string, eventProcessor func() bool) error {
|
||||
return pool.Submit(func() {
|
||||
start := time.Now()
|
||||
success := eventProcessor()
|
||||
metrics.AddEvent(time.Since(start), eventLabel, success)
|
||||
})
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue