Convert OOM Metric to Const
This converts the oom metric to be a const metric so that deleted tasks do not fill up the metric labels. Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
@@ -251,7 +251,9 @@ func (r *Runtime) Create(ctx context.Context, id string, opts runtime.CreateOpts
|
||||
}
|
||||
// after the task is created, add it to the monitor
|
||||
if err = r.monitor.Monitor(t); err != nil {
|
||||
r.tasks.Delete(ctx, t)
|
||||
if _, err := r.Delete(ctx, t); err != nil {
|
||||
log.G(ctx).WithError(err).Error("deleting task after failed monitor")
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
return t, nil
|
||||
@@ -269,6 +271,7 @@ func (r *Runtime) Delete(ctx context.Context, c runtime.Task) (*runtime.Exit, er
|
||||
if err := r.monitor.Stop(lc); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
rsp, err := lc.shim.Delete(ctx, empty)
|
||||
if err != nil {
|
||||
return nil, errdefs.FromGRPC(err)
|
||||
|
Reference in New Issue
Block a user