[#373] metabase: Add metrics

Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
Dmitrii Stepanov 2023-06-06 12:27:19 +03:00
parent f54cc0b607
commit 059e9e88a2
39 changed files with 379 additions and 96 deletions

View file

@ -98,16 +98,16 @@ func (e *StorageEngine) _select(ctx context.Context, prm SelectPrm) (SelectRes,
// If limit is zero, then returns all available object addresses.
//
// Returns an error if executions are blocked (see BlockExecution).
func (e *StorageEngine) List(limit uint64) (res SelectRes, err error) {
func (e *StorageEngine) List(ctx context.Context, limit uint64) (res SelectRes, err error) {
err = e.execIfNotBlocked(func() error {
res, err = e.list(limit)
res, err = e.list(ctx, limit)
return err
})
return
}
func (e *StorageEngine) list(limit uint64) (SelectRes, error) {
func (e *StorageEngine) list(ctx context.Context, limit uint64) (SelectRes, error) {
if e.metrics != nil {
defer elapsed("ListObjects", e.metrics.AddMethodDuration)()
}
@ -118,7 +118,7 @@ func (e *StorageEngine) list(limit uint64) (SelectRes, error) {
// consider iterating over shuffled shards
e.iterateOverUnsortedShards(func(sh hashedShard) (stop bool) {
res, err := sh.List() // consider limit result of shard iterator
res, err := sh.List(ctx) // consider limit result of shard iterator
if err != nil {
e.reportShardError(sh, "could not select objects from shard", err)
} else {
@ -159,8 +159,8 @@ func Select(ctx context.Context, storage *StorageEngine, cnr cid.ID, fs object.S
// List returns `limit` available physically storage object addresses in
// engine. If limit is zero, then returns all available object addresses.
func List(storage *StorageEngine, limit uint64) ([]oid.Address, error) {
res, err := storage.List(limit)
func List(ctx context.Context, storage *StorageEngine, limit uint64) ([]oid.Address, error) {
res, err := storage.List(ctx, limit)
if err != nil {
return nil, err
}