Use cgroups proto for prom metrics

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
Michael Crosby
2017-09-05 13:05:54 -04:00
parent 0973a084cf
commit ed45952826
9 changed files with 92 additions and 82 deletions

View File

@@ -19,7 +19,7 @@ type Task struct {
pid int
shim *client.Client
namespace string
cg *cgroups.Cgroup
cg cgroups.Cgroup
}
func newTask(id, namespace string, pid int, shim *client.Client) (*Task, error) {
@@ -210,5 +210,13 @@ func (t *Task) Process(ctx context.Context, id string) (runtime.Process, error)
}
func (t *Task) Metrics(ctx context.Context) (interface{}, error) {
return nil, nil
stats, err := t.cg.Stat(cgroups.IgnoreNotExist)
if err != nil {
return nil, err
}
return stats, nil
}
func (t *Task) Cgroup() cgroups.Cgroup {
return t.cg
}