mirror of
https://github.com/bcicen/ctop.git
synced 2025-12-06 15:16:41 +08:00
further collector refactoring, add logging to metrics subpackage
This commit is contained in:
@@ -21,12 +21,12 @@ func NewDocker(client *api.Client, id string) *Docker {
|
||||
Metrics: Metrics{},
|
||||
id: id,
|
||||
client: client,
|
||||
stream: make(chan Metrics),
|
||||
done: make(chan bool),
|
||||
}
|
||||
}
|
||||
|
||||
func (c *Docker) Start() {
|
||||
c.done = make(chan bool)
|
||||
c.stream = make(chan Metrics)
|
||||
stats := make(chan *api.Stats)
|
||||
|
||||
go func() {
|
||||
@@ -48,9 +48,11 @@ func (c *Docker) Start() {
|
||||
c.ReadNet(s)
|
||||
c.stream <- c.Metrics
|
||||
}
|
||||
log.Infof("collector stopped for container: %s", c.id)
|
||||
}()
|
||||
|
||||
c.running = true
|
||||
log.Infof("collector started for container: %s", c.id)
|
||||
}
|
||||
|
||||
func (c *Docker) Running() bool {
|
||||
|
||||
@@ -2,8 +2,12 @@ package metrics
|
||||
|
||||
import (
|
||||
"math"
|
||||
|
||||
"github.com/bcicen/ctop/logging"
|
||||
)
|
||||
|
||||
var log = logging.Init()
|
||||
|
||||
type Metrics struct {
|
||||
CPUUtil int
|
||||
NetTx int64
|
||||
|
||||
Reference in New Issue
Block a user