rename collector subpackage

This commit is contained in:
Bradley Cicenas 2017-02-23 02:03:55 +00:00
parent d06f07044f
commit 70f86c4812
5 changed files with 10 additions and 10 deletions

View File

@ -1,7 +1,7 @@
package main
import (
"github.com/bcicen/ctop/collector"
"github.com/bcicen/ctop/metrics"
"github.com/bcicen/ctop/widgets"
)
@ -9,7 +9,7 @@ type Container struct {
id string
name string
state string
metrics collector.Metrics
metrics metrics.Metrics
widgets widgets.ContainerWidgets
}
@ -27,7 +27,7 @@ func (c *Container) SetState(s string) {
}
// Read metric stream, updating widgets
func (c *Container) Read(stream chan collector.Metrics) {
func (c *Container) Read(stream chan metrics.Metrics) {
log.Infof("starting reader for container: %s", c.id)
go func() {
for metrics := range stream {

View File

@ -4,8 +4,8 @@ import (
"sort"
"strings"
"github.com/bcicen/ctop/collector"
"github.com/bcicen/ctop/config"
"github.com/bcicen/ctop/metrics"
"github.com/bcicen/ctop/widgets"
"github.com/fsouza/go-dockerclient"
)
@ -13,7 +13,7 @@ import (
type ContainerMap struct {
client *docker.Client
containers map[string]*Container
collectors map[string]collector.Collector
collectors map[string]metrics.Collector
}
func NewContainerMap() *ContainerMap {
@ -25,7 +25,7 @@ func NewContainerMap() *ContainerMap {
cm := &ContainerMap{
client: client,
containers: make(map[string]*Container),
collectors: make(map[string]collector.Collector),
collectors: make(map[string]metrics.Collector),
}
cm.Refresh()
return cm
@ -69,7 +69,7 @@ func (cm *ContainerMap) Refresh() {
if c.state == "running" {
if _, ok := cm.collectors[id]; ok == false {
log.Infof("starting collector for container: %s", id)
cm.collectors[id] = collector.NewDocker(cm.client, id)
cm.collectors[id] = metrics.NewDocker(cm.client, id)
cm.collectors[id].Start()
c.Read(cm.collectors[id].Stream())
}

View File

@ -1,4 +1,4 @@
package collector
package metrics
import (
api "github.com/fsouza/go-dockerclient"

View File

@ -1,4 +1,4 @@
package collector
package metrics
import (
"math"

View File

@ -1,4 +1,4 @@
package collector
package metrics
import (
"math/rand"