Remove go-metrics

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
Michael Crosby 2016-09-20 10:14:53 -07:00
parent 0645faf690
commit 058eea362a
12 changed files with 1 additions and 159 deletions

View file

@ -21,7 +21,6 @@ type AddProcessTask struct {
}
func (s *Supervisor) addProcess(t *AddProcessTask) error {
start := time.Now()
ci, ok := s.containers[t.ID]
if !ok {
return ErrContainerNotFound
@ -33,7 +32,6 @@ func (s *Supervisor) addProcess(t *AddProcessTask) error {
if err := s.monitorProcess(process); err != nil {
return err
}
ExecProcessTimer.UpdateSince(start)
t.StartResponse <- StartResponse{}
s.notifySubscribers(Event{
Timestamp: time.Now(),

View file

@ -2,7 +2,6 @@ package supervisor
import (
"path/filepath"
"time"
"github.com/docker/containerd/runtime"
)
@ -25,7 +24,6 @@ type StartTask struct {
}
func (s *Supervisor) start(t *StartTask) error {
start := time.Now()
rt := s.runtime
rtArgs := s.runtimeArgs
if t.Runtime != "" {
@ -49,7 +47,6 @@ func (s *Supervisor) start(t *StartTask) error {
s.containers[t.ID] = &containerInfo{
container: container,
}
ContainersCounter.Inc(1)
task := &startTask{
Err: t.ErrorCh(),
Container: container,
@ -63,6 +60,5 @@ func (s *Supervisor) start(t *StartTask) error {
}
s.startTasks <- task
ContainerCreateTimer.UpdateSince(start)
return errDeferredResponse
}

View file

@ -19,7 +19,6 @@ type DeleteTask struct {
func (s *Supervisor) delete(t *DeleteTask) error {
if i, ok := s.containers[t.ID]; ok {
start := time.Now()
if err := s.deleteContainer(i.container); err != nil {
logrus.WithField("error", err).Error("containerd: deleting container")
}
@ -35,8 +34,6 @@ func (s *Supervisor) delete(t *DeleteTask) error {
PID: t.PID,
})
}
ContainersCounter.Dec(1)
ContainerDeleteTimer.UpdateSince(start)
}
return nil
}

View file

@ -14,7 +14,6 @@ type ExitTask struct {
}
func (s *Supervisor) exit(t *ExitTask) error {
start := time.Now()
proc := t.Process
status, err := proc.ExitStatus()
if err != nil {
@ -52,9 +51,6 @@ func (s *Supervisor) exit(t *ExitTask) error {
Process: proc,
}
s.delete(ne)
ExitProcessTimer.UpdateSince(start)
return nil
}

View file

@ -1,42 +0,0 @@
package supervisor
import "github.com/rcrowley/go-metrics"
var (
// ContainerCreateTimer holds the metrics timer associated with container creation
ContainerCreateTimer = metrics.NewTimer()
// ContainerDeleteTimer holds the metrics timer associated with container deletion
ContainerDeleteTimer = metrics.NewTimer()
// ContainerStartTimer holds the metrics timer associated with container start duration
ContainerStartTimer = metrics.NewTimer()
// ContainerStatsTimer holds the metrics timer associated with container stats generation
ContainerStatsTimer = metrics.NewTimer()
// ContainersCounter keeps track of the number of active containers
ContainersCounter = metrics.NewCounter()
// EventSubscriberCounter keeps track of the number of active event subscribers
EventSubscriberCounter = metrics.NewCounter()
// TasksCounter keeps track of the number of active supervisor tasks
TasksCounter = metrics.NewCounter()
// ExecProcessTimer holds the metrics timer associated with container exec
ExecProcessTimer = metrics.NewTimer()
// ExitProcessTimer holds the metrics timer associated with reporting container exit status
ExitProcessTimer = metrics.NewTimer()
// EpollFdCounter keeps trac of how many process are being monitored
EpollFdCounter = metrics.NewCounter()
)
// Metrics return the list of all available metrics
func Metrics() map[string]interface{} {
return map[string]interface{}{
"container-create-time": ContainerCreateTimer,
"container-delete-time": ContainerDeleteTimer,
"container-start-time": ContainerStartTimer,
"container-stats-time": ContainerStatsTimer,
"containers": ContainersCounter,
"event-subscribers": EventSubscriberCounter,
"tasks": TasksCounter,
"exec-process-time": ExecProcessTimer,
"exit-process-time": ExitProcessTimer,
"epoll-fds": EpollFdCounter,
}
}

View file

@ -56,7 +56,6 @@ func (m *Monitor) Monitor(p runtime.Process) error {
if err := archutils.EpollCtl(m.epollFd, syscall.EPOLL_CTL_ADD, fd, &event); err != nil {
return err
}
EpollFdCounter.Inc(1)
m.receivers[fd] = p
return nil
}
@ -77,7 +76,6 @@ func (m *Monitor) MonitorOOM(c runtime.Container) error {
if err := archutils.EpollCtl(m.epollFd, syscall.EPOLL_CTL_ADD, fd, &event); err != nil {
return err
}
EpollFdCounter.Inc(1)
m.receivers[fd] = o
return nil
}
@ -115,7 +113,6 @@ func (m *Monitor) start() {
if err := t.Close(); err != nil {
logrus.WithField("error", err).Error("containerd: close process IO")
}
EpollFdCounter.Dec(1)
m.exits <- t
}
case runtime.OOM:
@ -125,7 +122,6 @@ func (m *Monitor) start() {
delete(m.receivers, fd)
// epoll will remove the fd from its set after it has been closed
t.Close()
EpollFdCounter.Dec(1)
} else {
m.ooms <- t.ContainerID()
}

View file

@ -1,10 +1,6 @@
package supervisor
import (
"time"
"github.com/docker/containerd/runtime"
)
import "github.com/docker/containerd/runtime"
// StatsTask holds needed parameters to retrieve a container statistics
type StatsTask struct {
@ -14,7 +10,6 @@ type StatsTask struct {
}
func (s *Supervisor) stats(t *StatsTask) error {
start := time.Now()
i, ok := s.containers[t.ID]
if !ok {
return ErrContainerNotFound
@ -28,7 +23,6 @@ func (s *Supervisor) stats(t *StatsTask) error {
}
t.ErrorCh() <- nil
t.Stat <- s
ContainerStatsTimer.UpdateSince(start)
}()
return errDeferredResponse
}

View file

@ -214,7 +214,6 @@ func (s *Supervisor) Events(from time.Time, storedOnly bool, id string) chan Eve
if storedOnly {
close(c)
} else {
EventSubscriberCounter.Inc(1)
s.subscribers[c] = struct{}{}
}
return c
@ -227,7 +226,6 @@ func (s *Supervisor) Unsubscribe(sub chan Event) {
if _, ok := s.subscribers[sub]; ok {
delete(s.subscribers, sub)
close(sub)
EventSubscriberCounter.Dec(1)
}
}
@ -276,7 +274,6 @@ func (s *Supervisor) Machine() Machine {
// SendTask sends the provided event the the supervisors main event loop
func (s *Supervisor) SendTask(evt Task) {
TasksCounter.Inc(1)
s.tasks <- evt
}
@ -321,7 +318,6 @@ func (s *Supervisor) restore() error {
return err
}
ContainersCounter.Inc(1)
s.containers[id] = &containerInfo{
container: container,
}

View file

@ -40,7 +40,6 @@ type worker struct {
func (w *worker) Start() {
defer w.wg.Done()
for t := range w.s.startTasks {
started := time.Now()
process, err := t.Container.Start(t.CheckpointPath, runtime.NewStdio(t.Stdin, t.Stdout, t.Stderr))
if err != nil {
logrus.WithFields(logrus.Fields{
@ -87,7 +86,6 @@ func (w *worker) Start() {
continue
}
}
ContainerStartTimer.UpdateSince(started)
t.Err <- nil
t.StartResponse <- StartResponse{
Container: t.Container,