Skip to content

Commit a1289d6

Browse files
darfuxfuweid
authored andcommitted
tasks: Monitor v2 tasks in initFunc as well
When containerd is restarted, only v1 tasks are monitored again. This leads to the lack of existing v2 task metrics. Signed-off-by: Li Yuxuan <[email protected]> (cherry picked from commit 4422ae3) Signed-off-by: Wei Fu <[email protected]>
1 parent 94c8bd9 commit a1289d6

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

services/tasks/local.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,13 @@ func initFunc(ic *plugin.InitContext) (interface{}, error) {
118118
l.monitor.Monitor(t)
119119
}
120120
}
121+
v2Tasks, err := l.v2Runtime.Tasks(ic.Context, true)
122+
if err != nil {
123+
return nil, err
124+
}
125+
for _, t := range v2Tasks {
126+
l.monitor.Monitor(t)
127+
}
121128
return l, nil
122129
}
123130

0 commit comments

Comments
 (0)