From 9c51f27385101183079a255075d63d5b026a7512 Mon Sep 17 00:00:00 2001 From: BarkovBG Date: Mon, 29 Jan 2024 15:45:27 +0300 Subject: [PATCH] NBS-4789: [Disk Manager] adding lister metrics for TaskStatusReadyToCancel and TaskStatusCancelling (#271) * adding more lister metrics * delete bad comment --- cloud/tasks/collect_lister_metrics_task.go | 30 +++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/cloud/tasks/collect_lister_metrics_task.go b/cloud/tasks/collect_lister_metrics_task.go index 3464e06f8c1..28d3da8d441 100644 --- a/cloud/tasks/collect_lister_metrics_task.go +++ b/cloud/tasks/collect_lister_metrics_task.go @@ -50,11 +50,25 @@ func (c collectListerMetricsTask) Run( return err } + err = c.collectTasksMetrics( + ctx, + func(context.Context) ([]storage.TaskInfo, error) { + return c.storage.ListTasksRunning( + ctx, + ^uint64(0), // limit + ) + }, + storage.TaskStatusToString(storage.TaskStatusRunning), + ) + if err != nil { + return err + } + err = c.collectTasksMetrics( ctx, func(context.Context) ([]storage.TaskInfo, error) { return c.storage.ListTasksReadyToCancel( - ctx, // excludingHostname + ctx, ^uint64(0), // limit nil, ) @@ -64,6 +78,20 @@ func (c collectListerMetricsTask) Run( if err != nil { return err } + + err = c.collectTasksMetrics( + ctx, + func(context.Context) ([]storage.TaskInfo, error) { + return c.storage.ListTasksCancelling( + ctx, + ^uint64(0), // limit + ) + }, + storage.TaskStatusToString(storage.TaskStatusCancelling), + ) + if err != nil { + return err + } } return nil