containerd/supervisor/stats.go
Michael Crosby 058eea362a Remove go-metrics
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2016-09-20 10:14:53 -07:00

28 lines
535 B
Go

package supervisor
import "github.com/docker/containerd/runtime"
// StatsTask holds needed parameters to retrieve a container statistics
type StatsTask struct {
baseTask
ID string
Stat chan *runtime.Stat
}
func (s *Supervisor) stats(t *StatsTask) error {
i, ok := s.containers[t.ID]
if !ok {
return ErrContainerNotFound
}
// TODO: use workers for this
go func() {
s, err := i.container.Stats()
if err != nil {
t.ErrorCh() <- err
return
}
t.ErrorCh() <- nil
t.Stat <- s
}()
return errDeferredResponse
}