Anton Nikiforov
5717d86173
All checks were successful
Tests and linters / Run gofumpt (pull_request) Successful in 2m46s
DCO action / DCO (pull_request) Successful in 2m43s
Tests and linters / Tests (1.22) (pull_request) Successful in 2m59s
Pre-commit hooks / Pre-commit (pull_request) Successful in 3m6s
Vulncheck / Vulncheck (pull_request) Successful in 2m52s
Build / Build Components (1.22) (pull_request) Successful in 3m24s
Build / Build Components (1.23) (pull_request) Successful in 3m24s
Tests and linters / Lint (pull_request) Successful in 3m44s
Tests and linters / Staticcheck (pull_request) Successful in 3m48s
Tests and linters / Tests (1.23) (pull_request) Successful in 3m54s
Tests and linters / Tests with -race (pull_request) Successful in 4m33s
Tests and linters / gopls check (pull_request) Successful in 4m31s
Signed-off-by: Anton Nikiforov <an.nikiforov@yadro.com>
70 lines
2 KiB
Go
70 lines
2 KiB
Go
package engine
|
|
|
|
import (
|
|
"time"
|
|
|
|
"git.frostfs.info/TrueCloudLab/frostfs-node/internal/metrics"
|
|
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/shard/mode"
|
|
)
|
|
|
|
type MetricRegister interface {
|
|
AddMethodDuration(method string, d time.Duration)
|
|
|
|
SetObjectCounter(shardID, objectType string, v uint64)
|
|
AddToObjectCounter(shardID, objectType string, delta int)
|
|
|
|
SetMode(shardID string, mode mode.Mode)
|
|
|
|
AddToContainerSize(cnrID string, size int64)
|
|
DeleteContainerSize(cnrID string)
|
|
DeleteContainerCount(cnrID string)
|
|
AddToPayloadCounter(shardID string, size int64)
|
|
IncErrorCounter(shardID string)
|
|
ClearErrorCounter(shardID string)
|
|
DeleteShardMetrics(shardID string)
|
|
|
|
SetContainerObjectCounter(shardID, contID, objectType string, v uint64)
|
|
IncContainerObjectCounter(shardID, contID, objectType string)
|
|
SubContainerObjectCounter(shardID, contID, objectType string, v uint64)
|
|
|
|
IncRefillObjectsCount(shardID, path string, size int, success bool)
|
|
SetRefillPercent(shardID, path string, percent uint32)
|
|
SetRefillStatus(shardID, path, status string)
|
|
SetEvacuationInProgress(shardID string, value bool)
|
|
|
|
WriteCache() metrics.WriteCacheMetrics
|
|
GC() metrics.GCMetrics
|
|
}
|
|
|
|
func elapsed(method string, addFunc func(method string, d time.Duration)) func() {
|
|
t := time.Now()
|
|
|
|
return func() {
|
|
addFunc(method, time.Since(t))
|
|
}
|
|
}
|
|
|
|
type gcMetrics struct {
|
|
storage metrics.GCMetrics
|
|
shardID string
|
|
}
|
|
|
|
func (m *gcMetrics) SetShardID(id string) {
|
|
m.shardID = id
|
|
}
|
|
|
|
func (m *gcMetrics) AddRunDuration(d time.Duration, success bool) {
|
|
m.storage.AddRunDuration(m.shardID, d, success)
|
|
}
|
|
|
|
func (m *gcMetrics) AddDeletedCount(deleted, failed uint64) {
|
|
m.storage.AddDeletedCount(m.shardID, deleted, failed)
|
|
}
|
|
|
|
func (m *gcMetrics) AddExpiredObjectCollectionDuration(d time.Duration, success bool, objectType string) {
|
|
m.storage.AddExpiredObjectCollectionDuration(m.shardID, d, success, objectType)
|
|
}
|
|
|
|
func (m *gcMetrics) AddInhumedObjectCount(count uint64, objectType string) {
|
|
m.storage.AddInhumedObjectCount(m.shardID, count, objectType)
|
|
}
|