Refactor task service metrics
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
@@ -5,6 +5,7 @@ package linux
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/containerd/cgroups"
|
||||
"github.com/containerd/containerd/api/types/task"
|
||||
"github.com/containerd/containerd/errdefs"
|
||||
client "github.com/containerd/containerd/linux/shim"
|
||||
@@ -18,15 +19,21 @@ type Task struct {
|
||||
pid int
|
||||
shim *client.Client
|
||||
namespace string
|
||||
cg *cgroups.Cgroup
|
||||
}
|
||||
|
||||
func newTask(id, namespace string, pid int, shim *client.Client) *Task {
|
||||
func newTask(id, namespace string, pid int, shim *client.Client) (*Task, error) {
|
||||
cg, err := cgroups.Load(cgroups.V1, cgroups.PidPath(pid))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &Task{
|
||||
id: id,
|
||||
pid: pid,
|
||||
shim: shim,
|
||||
namespace: namespace,
|
||||
}
|
||||
cg: cg,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (t *Task) ID() string {
|
||||
@@ -201,3 +208,7 @@ func (t *Task) Process(ctx context.Context, id string) (runtime.Process, error)
|
||||
t: t,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (t *Task) Metrics(ctx context.Context) (interface{}, error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user