mirror of
https://github.com/bcicen/ctop.git
synced 2024-08-30 18:23:19 +00:00
rename collector subpackage
This commit is contained in:
parent
d06f07044f
commit
70f86c4812
@ -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 {
|
||||
|
@ -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())
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
package collector
|
||||
package metrics
|
||||
|
||||
import (
|
||||
api "github.com/fsouza/go-dockerclient"
|
@ -1,4 +1,4 @@
|
||||
package collector
|
||||
package metrics
|
||||
|
||||
import (
|
||||
"math"
|
@ -1,4 +1,4 @@
|
||||
package collector
|
||||
package metrics
|
||||
|
||||
import (
|
||||
"math/rand"
|
Loading…
Reference in New Issue
Block a user