rename metrics subpackage

This commit is contained in:
Bradley Cicenas
2017-06-27 15:46:03 +00:00
parent bfa5c5944f
commit 2d284d9277
8 changed files with 32 additions and 32 deletions

View File

@@ -1,17 +1,17 @@
package collector
import (
"github.com/bcicen/ctop/metrics"
"github.com/bcicen/ctop/models"
api "github.com/fsouza/go-dockerclient"
)
// Docker collector
type Docker struct {
metrics.Metrics
models.Metrics
id string
client *api.Client
running bool
stream chan metrics.Metrics
stream chan models.Metrics
done chan bool
lastCpu float64
lastSysCpu float64
@@ -19,7 +19,7 @@ type Docker struct {
func NewDocker(client *api.Client, id string) *Docker {
return &Docker{
Metrics: metrics.Metrics{},
Metrics: models.Metrics{},
id: id,
client: client,
}
@@ -27,7 +27,7 @@ func NewDocker(client *api.Client, id string) *Docker {
func (c *Docker) Start() {
c.done = make(chan bool)
c.stream = make(chan metrics.Metrics)
c.stream = make(chan models.Metrics)
stats := make(chan *api.Stats)
go func() {
@@ -61,7 +61,7 @@ func (c *Docker) Running() bool {
return c.running
}
func (c *Docker) Stream() chan metrics.Metrics {
func (c *Docker) Stream() chan models.Metrics {
return c.stream
}

View File

@@ -6,13 +6,13 @@ import (
"math/rand"
"time"
"github.com/bcicen/ctop/metrics"
"github.com/bcicen/ctop/models"
)
// Mock collector
type Mock struct {
metrics.Metrics
stream chan metrics.Metrics
models.Metrics
stream chan models.Metrics
done bool
running bool
aggression int64
@@ -20,7 +20,7 @@ type Mock struct {
func NewMock(a int64) *Mock {
c := &Mock{
Metrics: metrics.Metrics{},
Metrics: models.Metrics{},
aggression: a,
}
c.MemLimit = 2147483648
@@ -33,7 +33,7 @@ func (c *Mock) Running() bool {
func (c *Mock) Start() {
c.done = false
c.stream = make(chan metrics.Metrics)
c.stream = make(chan models.Metrics)
go c.run()
}
@@ -41,7 +41,7 @@ func (c *Mock) Stop() {
c.done = true
}
func (c *Mock) Stream() chan metrics.Metrics {
func (c *Mock) Stream() chan models.Metrics {
return c.stream
}

View File

@@ -5,17 +5,17 @@ package collector
import (
"time"
"github.com/bcicen/ctop/metrics"
"github.com/bcicen/ctop/models"
"github.com/opencontainers/runc/libcontainer"
"github.com/opencontainers/runc/libcontainer/cgroups"
)
// Runc collector
type Runc struct {
metrics.Metrics
models.Metrics
id string
libc libcontainer.Container
stream chan metrics.Metrics
stream chan models.Metrics
done bool
running bool
interval int // collection interval, in seconds
@@ -25,7 +25,7 @@ type Runc struct {
func NewRunc(libc libcontainer.Container) *Runc {
c := &Runc{
Metrics: metrics.Metrics{},
Metrics: models.Metrics{},
id: libc.ID(),
libc: libc,
interval: 1,
@@ -39,7 +39,7 @@ func (c *Runc) Running() bool {
func (c *Runc) Start() {
c.done = false
c.stream = make(chan metrics.Metrics)
c.stream = make(chan models.Metrics)
go c.run()
}
@@ -47,7 +47,7 @@ func (c *Runc) Stop() {
c.done = true
}
func (c *Runc) Stream() chan metrics.Metrics {
func (c *Runc) Stream() chan models.Metrics {
return c.stream
}