diff --git a/cmd/frostfs-node/config.go b/cmd/frostfs-node/config.go index 5af37865f..336c4f9a5 100644 --- a/cmd/frostfs-node/config.go +++ b/cmd/frostfs-node/config.go @@ -884,7 +884,10 @@ func (c *cfg) engineOpts() []engine.Option { ) if c.metricsCollector != nil { - opts = append(opts, engine.WithMetrics(c.metricsCollector.Engine())) + opts = append(opts, + engine.WithEngineMetrics(c.metricsCollector.Engine()), + engine.WithWritecacheMetrics(c.metricsCollector.Writecachce()), + engine.WithGCMetrics(c.metricsCollector.GC())) } return opts diff --git a/internal/metrics/blobovnicza.go b/internal/metrics/blobovnicza.go index 948272c88..2fa9e7454 100644 --- a/internal/metrics/blobovnicza.go +++ b/internal/metrics/blobovnicza.go @@ -12,7 +12,7 @@ import ( type BlobobvnizcaMetrics interface { SetBlobobvnizcaTreeMode(shardID, path string, mode mode.ComponentMode) CloseBlobobvnizcaTree(shardID, path string) - BlobobvnizcaTreeMethodDuration(shardID, path string, method string, d time.Duration, success bool, withStorageID NullBool) + BlobobvnizcaTreeMethodDuration(shardID, path string, method string, d time.Duration, success bool, withStorageID string) AddBlobobvnizcaTreePut(shardID, path string, size int) AddBlobobvnizcaTreeGet(shardID, path string, size int) @@ -128,13 +128,13 @@ func (b *blobovnicza) CloseBlobobvnizcaTree(shardID, path string) { b.treeRebuildStatus.SetMode(shardID, path, undefinedStatus) } -func (b *blobovnicza) BlobobvnizcaTreeMethodDuration(shardID, path string, method string, d time.Duration, success bool, withStorageID NullBool) { +func (b *blobovnicza) BlobobvnizcaTreeMethodDuration(shardID, path string, method string, d time.Duration, success bool, withStorageID string) { b.treeReqDuration.With(prometheus.Labels{ shardIDLabel: shardID, pathLabel: path, successLabel: strconv.FormatBool(success), methodLabel: method, - withStorageIDLabel: withStorageID.String(), + withStorageIDLabel: withStorageID, }).Observe(d.Seconds()) } diff --git a/internal/metrics/blobstore.go b/internal/metrics/blobstore.go index d9bb3f029..36c25d347 100644 --- a/internal/metrics/blobstore.go +++ b/internal/metrics/blobstore.go @@ -12,7 +12,7 @@ type BlobstoreMetrics interface { SetMode(shardID string, readOnly bool) Close(shardID string) - MethodDuration(shardID string, method string, d time.Duration, success bool, withStorageID NullBool) + MethodDuration(shardID string, method string, d time.Duration, success bool, withStorageID string) AddPut(shardID string, size int) AddGet(shardID string, size int) } @@ -65,12 +65,12 @@ func (m *blobstoreMetrics) Close(shardID string) { }) } -func (m *blobstoreMetrics) MethodDuration(shardID string, method string, d time.Duration, success bool, withStorageID NullBool) { +func (m *blobstoreMetrics) MethodDuration(shardID string, method string, d time.Duration, success bool, withStorageID string) { m.reqDuration.With(prometheus.Labels{ shardIDLabel: shardID, successLabel: strconv.FormatBool(success), methodLabel: method, - withStorageIDLabel: withStorageID.String(), + withStorageIDLabel: withStorageID, }).Observe(d.Seconds()) } diff --git a/internal/metrics/engine.go b/internal/metrics/engine.go index 1d01c95ed..caa0b0999 100644 --- a/internal/metrics/engine.go +++ b/internal/metrics/engine.go @@ -28,9 +28,6 @@ type EngineMetrics interface { SetRefillPercent(shardID, path string, percent uint32) SetRefillStatus(shardID, path, status string) SetEvacuationInProgress(shardID string, value bool) - - WriteCache() WriteCacheMetrics - GC() GCMetrics } type engineMetrics struct { @@ -182,11 +179,11 @@ func (m *engineMetrics) SetMode(shardID string, mode mode.Mode) { m.mode.SetMode(shardID, mode.String()) } -func (m *engineMetrics) WriteCache() WriteCacheMetrics { +func (m *engineMetrics) WriteCache() any { return m.writeCache } -func (m *engineMetrics) GC() GCMetrics { +func (m *engineMetrics) GC() any { return m.gc } diff --git a/internal/metrics/node.go b/internal/metrics/node.go index 4ea3c7c24..535e151cb 100644 --- a/internal/metrics/node.go +++ b/internal/metrics/node.go @@ -79,6 +79,14 @@ func (m *NodeMetrics) Engine() EngineMetrics { return m.engine } +func (m *NodeMetrics) Writecachce() WriteCacheMetrics { + return m.engine.writeCache +} + +func (m *NodeMetrics) GC() GCMetrics { + return m.engine.gc +} + func (m *NodeMetrics) State() StateMetrics { return m.state } diff --git a/internal/metrics/types.go b/internal/metrics/types.go deleted file mode 100644 index 6a76248bf..000000000 --- a/internal/metrics/types.go +++ /dev/null @@ -1,17 +0,0 @@ -package metrics - -import ( - "strconv" -) - -type NullBool struct { - Bool bool - Valid bool // Valid is true if Bool is not NULL -} - -func (v NullBool) String() string { - if !v.Valid { - return "" - } - return strconv.FormatBool(v.Bool) -} diff --git a/internal/metrics/writecache.go b/internal/metrics/writecache.go index 1b708f710..a95c1f152 100644 --- a/internal/metrics/writecache.go +++ b/internal/metrics/writecache.go @@ -13,7 +13,7 @@ type WriteCacheMetrics interface { SetActualCount(shardID, path, storageType string, count uint64) SetEstimateSize(shardID, path, storageType string, size uint64) SetMode(shardID, mode string) - IncOperationCounter(shardID, path, storageType, operation string, success NullBool) + IncOperationCounter(shardID, path, storageType, operation string, success string) Close(shardID, path string) } @@ -80,12 +80,12 @@ func (m *writeCacheMetrics) SetMode(shardID string, mode string) { m.mode.SetMode(shardID, mode) } -func (m *writeCacheMetrics) IncOperationCounter(shardID, path, storageType, operation string, success NullBool) { +func (m *writeCacheMetrics) IncOperationCounter(shardID, path, storageType, operation string, success string) { m.operationCounter.With(prometheus.Labels{ shardIDLabel: shardID, storageLabel: storageType, operationLabel: operation, - successLabel: success.String(), + successLabel: success, pathLabel: path, }).Inc() } diff --git a/pkg/local_object_storage/engine/container.go b/pkg/local_object_storage/engine/container.go index 24059a3f9..05b8513d7 100644 --- a/pkg/local_object_storage/engine/container.go +++ b/pkg/local_object_storage/engine/container.go @@ -45,7 +45,7 @@ func (r ListContainersRes) Containers() []cid.ID { // // Returns an error if executions are blocked (see BlockExecution). func (e *StorageEngine) ContainerSize(ctx context.Context, prm ContainerSizePrm) (res ContainerSizeRes, err error) { - defer elapsed("ContainerSize", e.metrics.AddMethodDuration)() + defer elapsed("ContainerSize", e.engineMetrics.AddMethodDuration)() err = e.execIfNotBlocked(func() error { res, err = e.containerSize(ctx, prm) @@ -93,7 +93,7 @@ func (e *StorageEngine) containerSize(ctx context.Context, prm ContainerSizePrm) // // Returns an error if executions are blocked (see BlockExecution). func (e *StorageEngine) ListContainers(ctx context.Context, _ ListContainersPrm) (res ListContainersRes, err error) { - defer elapsed("ListContainers", e.metrics.AddMethodDuration)() + defer elapsed("ListContainers", e.engineMetrics.AddMethodDuration)() err = e.execIfNotBlocked(func() error { res, err = e.listContainers(ctx) diff --git a/pkg/local_object_storage/engine/delete.go b/pkg/local_object_storage/engine/delete.go index 7164ff21f..fce51cd2b 100644 --- a/pkg/local_object_storage/engine/delete.go +++ b/pkg/local_object_storage/engine/delete.go @@ -58,7 +58,7 @@ func (e *StorageEngine) Delete(ctx context.Context, prm DeletePrm) (res DeleteRe attribute.Bool("force_removal", prm.forceRemoval), )) defer span.End() - defer elapsed("Delete", e.metrics.AddMethodDuration)() + defer elapsed("Delete", e.engineMetrics.AddMethodDuration)() err = e.execIfNotBlocked(func() error { res, err = e.delete(ctx, prm) diff --git a/pkg/local_object_storage/engine/engine.go b/pkg/local_object_storage/engine/engine.go index 029904046..248edbd3f 100644 --- a/pkg/local_object_storage/engine/engine.go +++ b/pkg/local_object_storage/engine/engine.go @@ -145,7 +145,7 @@ func (e *StorageEngine) reportShardError( } errCount := sh.errorCount.Add(1) - e.metrics.IncErrorCounter(sh.ID().String()) + e.engineMetrics.IncErrorCounter(sh.ID().String()) sid := sh.ID() e.log.Warn(ctx, msg, append([]zap.Field{ @@ -187,7 +187,9 @@ type cfg struct { errorsThreshold uint32 - metrics MetricRegister + engineMetrics EngineMetrics + writeCacheMetrics WriteCacheMetrics + gcMetrics GCMetrics shardPoolSize uint32 @@ -200,7 +202,10 @@ func defaultCfg() *cfg { res := &cfg{ log: logger.NewLoggerWrapper(zap.L()), shardPoolSize: 20, - metrics: noopMetrics{}, + + engineMetrics: noopMetrics{}, + writeCacheMetrics: noopWriteCacheMetrics{}, + gcMetrics: noopGCMetrics{}, } res.containerSource.Store(&containerSource{}) return res @@ -231,9 +236,21 @@ func WithLogger(l *logger.Logger) Option { } } -func WithMetrics(v MetricRegister) Option { +func WithEngineMetrics(v EngineMetrics) Option { return func(c *cfg) { - c.metrics = v + c.engineMetrics = v + } +} + +func WithWritecacheMetrics(v WriteCacheMetrics) Option { + return func(c *cfg) { + c.writeCacheMetrics = v + } +} + +func WithGCMetrics(v GCMetrics) Option { + return func(c *cfg) { + c.gcMetrics = v } } diff --git a/pkg/local_object_storage/engine/get.go b/pkg/local_object_storage/engine/get.go index c7145889b..d4bc7cfef 100644 --- a/pkg/local_object_storage/engine/get.go +++ b/pkg/local_object_storage/engine/get.go @@ -56,7 +56,7 @@ func (e *StorageEngine) Get(ctx context.Context, prm GetPrm) (res GetRes, err er attribute.String("address", prm.addr.EncodeToString()), )) defer span.End() - defer elapsed("Get", e.metrics.AddMethodDuration)() + defer elapsed("Get", e.engineMetrics.AddMethodDuration)() err = e.execIfNotBlocked(func() error { res, err = e.get(ctx, prm) diff --git a/pkg/local_object_storage/engine/head.go b/pkg/local_object_storage/engine/head.go index d6892f129..80f969bbe 100644 --- a/pkg/local_object_storage/engine/head.go +++ b/pkg/local_object_storage/engine/head.go @@ -68,7 +68,7 @@ func (e *StorageEngine) Head(ctx context.Context, prm HeadPrm) (res HeadRes, err func (e *StorageEngine) head(ctx context.Context, prm HeadPrm) (HeadRes, error) { ctx, span := tracing.StartSpanFromContext(ctx, "StorageEngine.head") defer span.End() - defer elapsed("Head", e.metrics.AddMethodDuration)() + defer elapsed("Head", e.engineMetrics.AddMethodDuration)() var ( head *objectSDK.Object diff --git a/pkg/local_object_storage/engine/inhume.go b/pkg/local_object_storage/engine/inhume.go index e89a8d048..56f2caef3 100644 --- a/pkg/local_object_storage/engine/inhume.go +++ b/pkg/local_object_storage/engine/inhume.go @@ -70,7 +70,7 @@ var errInhumeFailure = errors.New("inhume operation failed") func (e *StorageEngine) Inhume(ctx context.Context, prm InhumePrm) (res InhumeRes, err error) { ctx, span := tracing.StartSpanFromContext(ctx, "StorageEngine.Inhume") defer span.End() - defer elapsed("Inhume", e.metrics.AddMethodDuration)() + defer elapsed("Inhume", e.engineMetrics.AddMethodDuration)() err = e.execIfNotBlocked(func() error { res, err = e.inhume(ctx, prm) @@ -360,7 +360,7 @@ func (e *StorageEngine) processZeroSizeContainers(ctx context.Context, ids []cid } for id := range idMap { - e.metrics.DeleteContainerSize(id.EncodeToString()) + e.engineMetrics.DeleteContainerSize(id.EncodeToString()) } } @@ -438,7 +438,7 @@ func (e *StorageEngine) processZeroCountContainers(ctx context.Context, ids []ci } for id := range idMap { - e.metrics.DeleteContainerCount(id.EncodeToString()) + e.engineMetrics.DeleteContainerCount(id.EncodeToString()) } } diff --git a/pkg/local_object_storage/engine/list.go b/pkg/local_object_storage/engine/list.go index 073248862..ff6010efd 100644 --- a/pkg/local_object_storage/engine/list.go +++ b/pkg/local_object_storage/engine/list.go @@ -101,7 +101,7 @@ func (l ListWithCursorRes) Cursor() *Cursor { func (e *StorageEngine) ListWithCursor(ctx context.Context, prm ListWithCursorPrm) (ListWithCursorRes, error) { ctx, span := tracing.StartSpanFromContext(ctx, "StorageEngine.ListWithCursor") defer span.End() - defer elapsed("ListWithCursor", e.metrics.AddMethodDuration)() + defer elapsed("ListWithCursor", e.engineMetrics.AddMethodDuration)() result := make([]objectcore.Info, 0, prm.count) diff --git a/pkg/local_object_storage/engine/lock.go b/pkg/local_object_storage/engine/lock.go index 5d43e59df..4e8c65a7c 100644 --- a/pkg/local_object_storage/engine/lock.go +++ b/pkg/local_object_storage/engine/lock.go @@ -32,7 +32,7 @@ func (e *StorageEngine) Lock(ctx context.Context, idCnr cid.ID, locker oid.ID, l attribute.Int("locked_count", len(locked)), )) defer span.End() - defer elapsed("Lock", e.metrics.AddMethodDuration)() + defer elapsed("Lock", e.engineMetrics.AddMethodDuration)() return e.execIfNotBlocked(func() error { return e.lock(ctx, idCnr, locker, locked) diff --git a/pkg/local_object_storage/engine/metrics.go b/pkg/local_object_storage/engine/metrics.go index 75936206d..7754808ac 100644 --- a/pkg/local_object_storage/engine/metrics.go +++ b/pkg/local_object_storage/engine/metrics.go @@ -7,7 +7,23 @@ import ( "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/shard/mode" ) -type MetricRegister interface { +type WriteCacheMetrics interface { + AddMethodDuration(shardID, path, storageType, method string, success bool, d time.Duration) + SetActualCount(shardID, path, storageType string, count uint64) + SetEstimateSize(shardID, path, storageType string, size uint64) + SetMode(shardID, mode string) + IncOperationCounter(shardID, path, storageType, operation string, success string) + Close(shardID, path string) +} + +type GCMetrics interface { + AddRunDuration(shardID string, d time.Duration, success bool) + AddDeletedCount(shardID string, deleted, failed uint64) + AddExpiredObjectCollectionDuration(shardID string, d time.Duration, success bool, objectType string) + AddInhumedObjectCount(shardID string, count uint64, objectType string) +} + +type EngineMetrics interface { AddMethodDuration(method string, d time.Duration) SetObjectCounter(shardID, objectType string, v uint64) @@ -31,9 +47,6 @@ type MetricRegister interface { 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() { @@ -76,9 +89,9 @@ type ( ) var ( - _ MetricRegister = noopMetrics{} - _ metrics.WriteCacheMetrics = noopWriteCacheMetrics{} - _ metrics.GCMetrics = noopGCMetrics{} + _ EngineMetrics = noopMetrics{} + _ WriteCacheMetrics = noopWriteCacheMetrics{} + _ GCMetrics = noopGCMetrics{} ) func (noopMetrics) AddMethodDuration(string, time.Duration) {} @@ -99,14 +112,12 @@ 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 (noopWriteCacheMetrics) AddMethodDuration(string, string, string, string, bool, time.Duration) {} func (noopWriteCacheMetrics) SetActualCount(string, string, string, uint64) {} func (noopWriteCacheMetrics) SetEstimateSize(string, string, string, uint64) {} func (noopWriteCacheMetrics) SetMode(string, string) {} -func (noopWriteCacheMetrics) IncOperationCounter(string, string, string, string, metrics.NullBool) {} +func (noopWriteCacheMetrics) IncOperationCounter(string, string, string, string, string) {} func (noopWriteCacheMetrics) Close(string, string) {} func (noopGCMetrics) AddRunDuration(string, time.Duration, bool) {} diff --git a/pkg/local_object_storage/engine/put.go b/pkg/local_object_storage/engine/put.go index e080191ae..10d949f09 100644 --- a/pkg/local_object_storage/engine/put.go +++ b/pkg/local_object_storage/engine/put.go @@ -56,7 +56,7 @@ func (e *StorageEngine) Put(ctx context.Context, prm PutPrm) (err error) { attribute.String("address", object.AddressOf(prm.Object).EncodeToString()), )) defer span.End() - defer elapsed("Put", e.metrics.AddMethodDuration)() + defer elapsed("Put", e.engineMetrics.AddMethodDuration)() err = e.execIfNotBlocked(func() error { err = e.put(ctx, prm) diff --git a/pkg/local_object_storage/engine/range.go b/pkg/local_object_storage/engine/range.go index 0c9cea903..cac6a6971 100644 --- a/pkg/local_object_storage/engine/range.go +++ b/pkg/local_object_storage/engine/range.go @@ -72,7 +72,7 @@ func (e *StorageEngine) GetRange(ctx context.Context, prm RngPrm) (res RngRes, e attribute.String("length", strconv.FormatUint(prm.ln, 10)), )) defer span.End() - defer elapsed("GetRange", e.metrics.AddMethodDuration)() + defer elapsed("GetRange", e.engineMetrics.AddMethodDuration)() err = e.execIfNotBlocked(func() error { res, err = e.getRange(ctx, prm) diff --git a/pkg/local_object_storage/engine/select.go b/pkg/local_object_storage/engine/select.go index 02149b4c8..8074d3363 100644 --- a/pkg/local_object_storage/engine/select.go +++ b/pkg/local_object_storage/engine/select.go @@ -51,7 +51,7 @@ func (e *StorageEngine) Select(ctx context.Context, prm SelectPrm) (res SelectRe attribute.String("container_id", prm.cnr.EncodeToString()), )) defer span.End() - defer elapsed("Select", e.metrics.AddMethodDuration)() + defer elapsed("Select", e.engineMetrics.AddMethodDuration)() err = e.execIfNotBlocked(func() error { res, err = e._select(ctx, prm) @@ -98,7 +98,7 @@ func (e *StorageEngine) _select(ctx context.Context, prm SelectPrm) (SelectRes, // // Returns an error if executions are blocked (see BlockExecution). func (e *StorageEngine) List(ctx context.Context, limit uint64) (res SelectRes, err error) { - defer elapsed("List", e.metrics.AddMethodDuration)() + defer elapsed("List", e.engineMetrics.AddMethodDuration)() err = e.execIfNotBlocked(func() error { res, err = e.list(ctx, limit) return err diff --git a/pkg/local_object_storage/engine/shards.go b/pkg/local_object_storage/engine/shards.go index 898f685ec..8dff217a3 100644 --- a/pkg/local_object_storage/engine/shards.go +++ b/pkg/local_object_storage/engine/shards.go @@ -28,7 +28,7 @@ type hashedShard struct { type metricsWithID struct { id string - mw MetricRegister + mw EngineMetrics } func (m *metricsWithID) SetShardID(id string) { @@ -116,7 +116,7 @@ func (e *StorageEngine) AddShard(ctx context.Context, opts ...shard.Option) (*sh return nil, fmt.Errorf("could not add %s shard: %w", sh.ID().String(), err) } - e.cfg.metrics.SetMode(sh.ID().String(), sh.GetMode()) + e.cfg.engineMetrics.SetMode(sh.ID().String(), sh.GetMode()) return sh.ID(), nil } @@ -154,18 +154,18 @@ func (e *StorageEngine) appendMetrics(id *shard.ID, opts []shard.Option) []shard shard.WithMetricsWriter( &metricsWithID{ id: id.String(), - mw: e.metrics, + mw: e.engineMetrics, }, ), shard.WithWriteCacheMetrics( &writeCacheMetrics{ shardID: id.String(), - metrics: e.metrics.WriteCache(), + metrics: e.writeCacheMetrics, }, ), shard.WithGCMetrics( &gcMetrics{ - storage: e.metrics.GC(), + storage: e.gcMetrics, shardID: id.String(), }, ), @@ -217,7 +217,7 @@ func (e *StorageEngine) removeShards(ctx context.Context, ids ...string) { continue } - e.metrics.DeleteShardMetrics(id) + e.engineMetrics.DeleteShardMetrics(id) ss = append(ss, sh) delete(e.shards, id) @@ -318,7 +318,7 @@ func (e *StorageEngine) SetShardMode(ctx context.Context, id *shard.ID, m mode.M if id.String() == shID { if resetErrorCounter { sh.errorCount.Store(0) - e.metrics.ClearErrorCounter(shID) + e.engineMetrics.ClearErrorCounter(shID) } return sh.SetMode(ctx, m) } @@ -422,7 +422,7 @@ func (e *StorageEngine) deleteShards(ctx context.Context, ids []*shard.ID) ([]ha for _, sh := range ss { idStr := sh.ID().String() - e.metrics.DeleteShardMetrics(idStr) + e.engineMetrics.DeleteShardMetrics(idStr) delete(e.shards, idStr) diff --git a/pkg/local_object_storage/engine/writecache.go b/pkg/local_object_storage/engine/writecache.go index e9ba3410f..4caf48ab7 100644 --- a/pkg/local_object_storage/engine/writecache.go +++ b/pkg/local_object_storage/engine/writecache.go @@ -2,6 +2,7 @@ package engine import ( "context" + "strconv" "sync" "time" @@ -182,11 +183,11 @@ func (m *writeCacheMetrics) SetActualCounters(count uint64) { } func (m *writeCacheMetrics) Flush(success bool, st writecache.StorageType) { - m.metrics.IncOperationCounter(m.shardID, m.path, st.String(), "Flush", metrics.NullBool{Bool: success, Valid: true}) + m.metrics.IncOperationCounter(m.shardID, m.path, st.String(), "Flush", strconv.FormatBool(success)) } func (m *writeCacheMetrics) Evict(st writecache.StorageType) { - m.metrics.IncOperationCounter(m.shardID, m.path, st.String(), "Evict", metrics.NullBool{}) + m.metrics.IncOperationCounter(m.shardID, m.path, st.String(), "Evict", "") } func (m *writeCacheMetrics) Close() { diff --git a/pkg/local_object_storage/metrics/blobovnicza.go b/pkg/local_object_storage/metrics/blobovnicza.go index 460d6e638..475d72005 100644 --- a/pkg/local_object_storage/metrics/blobovnicza.go +++ b/pkg/local_object_storage/metrics/blobovnicza.go @@ -1,6 +1,7 @@ package metrics import ( + "strconv" "time" metrics_impl "git.frostfs.info/TrueCloudLab/frostfs-node/internal/metrics" @@ -56,40 +57,40 @@ func (m *blobovniczaTreeMetrics) ObjectMoved(d time.Duration) { } func (m *blobovniczaTreeMetrics) Delete(d time.Duration, success, withStorageID bool) { - m.m.BlobobvnizcaTreeMethodDuration(m.shardID, m.path, "Delete", d, success, metrics_impl.NullBool{Valid: true, Bool: withStorageID}) + m.m.BlobobvnizcaTreeMethodDuration(m.shardID, m.path, "Delete", d, success, strconv.FormatBool(withStorageID)) } func (m *blobovniczaTreeMetrics) Exists(d time.Duration, success, withStorageID bool) { - m.m.BlobobvnizcaTreeMethodDuration(m.shardID, m.path, "Exists", d, success, metrics_impl.NullBool{Valid: true, Bool: withStorageID}) + m.m.BlobobvnizcaTreeMethodDuration(m.shardID, m.path, "Exists", d, success, strconv.FormatBool(withStorageID)) } func (m *blobovniczaTreeMetrics) GetRange(d time.Duration, size int, success, withStorageID bool) { - m.m.BlobobvnizcaTreeMethodDuration(m.shardID, m.path, "GetRange", d, success, metrics_impl.NullBool{Valid: true, Bool: withStorageID}) + m.m.BlobobvnizcaTreeMethodDuration(m.shardID, m.path, "GetRange", d, success, strconv.FormatBool(withStorageID)) if success { m.m.AddBlobobvnizcaTreeGet(m.shardID, m.path, size) } } func (m *blobovniczaTreeMetrics) Get(d time.Duration, size int, success, withStorageID bool) { - m.m.BlobobvnizcaTreeMethodDuration(m.shardID, m.path, "Get", d, success, metrics_impl.NullBool{Valid: true, Bool: withStorageID}) + m.m.BlobobvnizcaTreeMethodDuration(m.shardID, m.path, "Get", d, success, strconv.FormatBool(withStorageID)) if success { m.m.AddBlobobvnizcaTreeGet(m.shardID, m.path, size) } } func (m *blobovniczaTreeMetrics) Iterate(d time.Duration, success bool) { - m.m.BlobobvnizcaTreeMethodDuration(m.shardID, m.path, "Iterate", d, success, metrics_impl.NullBool{}) + m.m.BlobobvnizcaTreeMethodDuration(m.shardID, m.path, "Iterate", d, success, "") } func (m *blobovniczaTreeMetrics) Put(d time.Duration, size int, success bool) { - m.m.BlobobvnizcaTreeMethodDuration(m.shardID, m.path, "Put", d, success, metrics_impl.NullBool{}) + m.m.BlobobvnizcaTreeMethodDuration(m.shardID, m.path, "Put", d, success, "") if success { m.m.AddBlobobvnizcaTreePut(m.shardID, m.path, size) } } func (m *blobovniczaTreeMetrics) ObjectsCount(d time.Duration, success bool) { - m.m.BlobobvnizcaTreeMethodDuration(m.shardID, m.path, "ObjectsCount", d, success, metrics_impl.NullBool{}) + m.m.BlobobvnizcaTreeMethodDuration(m.shardID, m.path, "ObjectsCount", d, success, "") } type blobovniczaMetrics struct { diff --git a/pkg/local_object_storage/metrics/blobstore.go b/pkg/local_object_storage/metrics/blobstore.go index 9a41f01d0..0969bf42e 100644 --- a/pkg/local_object_storage/metrics/blobstore.go +++ b/pkg/local_object_storage/metrics/blobstore.go @@ -1,6 +1,7 @@ package metrics import ( + "strconv" "time" metrics_impl "git.frostfs.info/TrueCloudLab/frostfs-node/internal/metrics" @@ -32,38 +33,38 @@ func (m *blobstoreMetrics) Close() { } func (m *blobstoreMetrics) Delete(d time.Duration, success, withStorageID bool) { - m.m.MethodDuration(m.shardID, "Delete", d, success, metrics_impl.NullBool{Bool: withStorageID, Valid: true}) + m.m.MethodDuration(m.shardID, "Delete", d, success, strconv.FormatBool(withStorageID)) } func (m *blobstoreMetrics) Exists(d time.Duration, success, withStorageID bool) { - m.m.MethodDuration(m.shardID, "Exists", d, success, metrics_impl.NullBool{Bool: withStorageID, Valid: true}) + m.m.MethodDuration(m.shardID, "Exists", d, success, strconv.FormatBool(withStorageID)) } func (m *blobstoreMetrics) GetRange(d time.Duration, size int, success, withStorageID bool) { - m.m.MethodDuration(m.shardID, "GetRange", d, success, metrics_impl.NullBool{Bool: withStorageID, Valid: true}) + m.m.MethodDuration(m.shardID, "GetRange", d, success, strconv.FormatBool(withStorageID)) if success { m.m.AddGet(m.shardID, size) } } func (m *blobstoreMetrics) Get(d time.Duration, size int, success, withStorageID bool) { - m.m.MethodDuration(m.shardID, "Get", d, success, metrics_impl.NullBool{Bool: withStorageID, Valid: true}) + m.m.MethodDuration(m.shardID, "Get", d, success, strconv.FormatBool(withStorageID)) if success { m.m.AddGet(m.shardID, size) } } func (m *blobstoreMetrics) Iterate(d time.Duration, success bool) { - m.m.MethodDuration(m.shardID, "Iterate", d, success, metrics_impl.NullBool{}) + m.m.MethodDuration(m.shardID, "Iterate", d, success, "") } func (m *blobstoreMetrics) Put(d time.Duration, size int, success bool) { - m.m.MethodDuration(m.shardID, "Put", d, success, metrics_impl.NullBool{}) + m.m.MethodDuration(m.shardID, "Put", d, success, "") if success { m.m.AddPut(m.shardID, size) } } func (m *blobstoreMetrics) ObjectsCount(d time.Duration, success bool) { - m.m.MethodDuration(m.shardID, "ObjectsCount", d, success, metrics_impl.NullBool{}) + m.m.MethodDuration(m.shardID, "ObjectsCount", d, success, "") }