forked from TrueCloudLab/frostfs-node
[#373] metabase: Add metrics
Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
parent
f54cc0b607
commit
059e9e88a2
39 changed files with 379 additions and 96 deletions
|
@ -1,6 +1,8 @@
|
|||
package engine
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/shard"
|
||||
cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id"
|
||||
"go.uber.org/zap"
|
||||
|
@ -92,9 +94,9 @@ func (e *StorageEngine) containerSize(prm ContainerSizePrm) (res ContainerSizeRe
|
|||
// ListContainers returns a unique container IDs presented in the engine objects.
|
||||
//
|
||||
// Returns an error if executions are blocked (see BlockExecution).
|
||||
func (e *StorageEngine) ListContainers(_ ListContainersPrm) (res ListContainersRes, err error) {
|
||||
func (e *StorageEngine) ListContainers(ctx context.Context, _ ListContainersPrm) (res ListContainersRes, err error) {
|
||||
err = e.execIfNotBlocked(func() error {
|
||||
res, err = e.listContainers()
|
||||
res, err = e.listContainers(ctx)
|
||||
return err
|
||||
})
|
||||
|
||||
|
@ -102,10 +104,10 @@ func (e *StorageEngine) ListContainers(_ ListContainersPrm) (res ListContainersR
|
|||
}
|
||||
|
||||
// ListContainers calls ListContainers method on engine to get a unique container IDs presented in the engine objects.
|
||||
func ListContainers(e *StorageEngine) ([]cid.ID, error) {
|
||||
func ListContainers(ctx context.Context, e *StorageEngine) ([]cid.ID, error) {
|
||||
var prm ListContainersPrm
|
||||
|
||||
res, err := e.ListContainers(prm)
|
||||
res, err := e.ListContainers(ctx, prm)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -113,7 +115,7 @@ func ListContainers(e *StorageEngine) ([]cid.ID, error) {
|
|||
return res.Containers(), nil
|
||||
}
|
||||
|
||||
func (e *StorageEngine) listContainers() (ListContainersRes, error) {
|
||||
func (e *StorageEngine) listContainers(ctx context.Context) (ListContainersRes, error) {
|
||||
if e.metrics != nil {
|
||||
defer elapsed("ListContainers", e.metrics.AddMethodDuration)()
|
||||
}
|
||||
|
@ -121,7 +123,7 @@ func (e *StorageEngine) listContainers() (ListContainersRes, error) {
|
|||
uniqueIDs := make(map[string]cid.ID)
|
||||
|
||||
e.iterateOverUnsortedShards(func(sh hashedShard) (stop bool) {
|
||||
res, err := sh.Shard.ListContainers(shard.ListContainersPrm{})
|
||||
res, err := sh.Shard.ListContainers(ctx, shard.ListContainersPrm{})
|
||||
if err != nil {
|
||||
e.reportShardError(sh, "can't get list of containers", err)
|
||||
return false
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue