[#1596] metrics: Create public aliases for internal engine metrics
All checks were successful
Vulncheck / Vulncheck (push) Successful in 58s
Pre-commit hooks / Pre-commit (push) Successful in 1m21s
Build / Build Components (push) Successful in 1m33s
Tests and linters / gopls check (push) Successful in 2m14s
Tests and linters / Run gofumpt (push) Successful in 2m55s
Tests and linters / Tests (push) Successful in 2m59s
Tests and linters / Staticcheck (push) Successful in 3m7s
Tests and linters / Lint (push) Successful in 3m15s
Tests and linters / Tests with -race (push) Successful in 3m44s

Signed-off-by: Anton Nikiforov <an.nikiforov@yadro.com>
This commit is contained in:
Anton Nikiforov 2025-01-13 12:52:02 +03:00 committed by Evgenii Stratonikov
parent a2485637bb
commit 6c51f48aab

View file

@ -7,34 +7,12 @@ import (
"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
}
type (
MetricRegister = metrics.EngineMetrics
GCMetrics = metrics.GCMetrics
WriteCacheMetrics = metrics.WriteCacheMetrics
NullBool = metrics.NullBool
)
func elapsed(method string, addFunc func(method string, d time.Duration)) func() {
t := time.Now()
@ -76,9 +54,9 @@ type (
)
var (
_ MetricRegister = noopMetrics{}
_ metrics.WriteCacheMetrics = noopWriteCacheMetrics{}
_ metrics.GCMetrics = noopGCMetrics{}
_ MetricRegister = noopMetrics{}
_ WriteCacheMetrics = noopWriteCacheMetrics{}
_ GCMetrics = noopGCMetrics{}
)
func (noopMetrics) AddMethodDuration(string, time.Duration) {}
@ -99,8 +77,8 @@ func (noopMetrics) IncRefillObjectsCount(string, string, int, bool) {}
func (noopMetrics) SetRefillPercent(string, string, uint32) {}
func (noopMetrics) SetRefillStatus(string, string, string) {}
func (noopMetrics) SetEvacuationInProgress(string, bool) {}
func (noopMetrics) WriteCache() metrics.WriteCacheMetrics { return noopWriteCacheMetrics{} }
func (noopMetrics) GC() metrics.GCMetrics { return noopGCMetrics{} }
func (noopMetrics) WriteCache() WriteCacheMetrics { return noopWriteCacheMetrics{} }
func (noopMetrics) GC() GCMetrics { return noopGCMetrics{} }
func (noopWriteCacheMetrics) AddMethodDuration(string, string, string, string, bool, time.Duration) {}
func (noopWriteCacheMetrics) SetActualCount(string, string, string, uint64) {}