diff --git a/cloud/tasks/register_system_tasks.go b/cloud/tasks/register_system_tasks.go index bf9a767e28..428ea568a5 100644 --- a/cloud/tasks/register_system_tasks.go +++ b/cloud/tasks/register_system_tasks.go @@ -68,6 +68,13 @@ func RegisterSystemTasks( return err } + collectListerMetricsTaskScheduleInterval, err := time.ParseDuration( + config.GetCollectListerMetricsTaskScheduleInterval(), + ) + if err != nil { + return err + } + err = registry.RegisterForExecution( "tasks.CollectListerMetrics", func() Task { return &collectListerMetricsTask{ @@ -75,8 +82,6 @@ func RegisterSystemTasks( storage: storage, metricsCollectionInterval: listerMetricsCollectionInterval, - // This task is registered in control plane and collects metrics - // for all types of tasks. taskTypes: registry.TaskTypes(), hangingTaskGaugesByID: make(map[string]metrics.Gauge), maxHangingTaskIDsToReport: config.GetMaxHangingTaskIDsToReport(), @@ -87,13 +92,6 @@ func RegisterSystemTasks( return err } - collectListerMetricsTaskScheduleInterval, err := time.ParseDuration( - config.GetCollectListerMetricsTaskScheduleInterval(), - ) - if err != nil { - return err - } - taskScheduler.ScheduleRegularTasks( ctx, "tasks.CollectListerMetrics",