mirror of
https://github.com/bcicen/ctop.git
synced 2024-08-30 18:23:19 +00:00
initialize metrics with negative value prior to collector start
This commit is contained in:
parent
69128f1947
commit
2c198ae2a0
@ -19,8 +19,9 @@ type Container struct {
|
|||||||
|
|
||||||
func NewContainer(id, name string) *Container {
|
func NewContainer(id, name string) *Container {
|
||||||
c := &Container{
|
c := &Container{
|
||||||
id: id,
|
id: id,
|
||||||
name: name,
|
name: name,
|
||||||
|
metrics: metrics.NewMetrics(),
|
||||||
}
|
}
|
||||||
c.widgets = compact.NewCompact(c.ShortID(), c.ShortName(), c.state)
|
c.widgets = compact.NewCompact(c.ShortID(), c.ShortName(), c.state)
|
||||||
return c
|
return c
|
||||||
|
@ -17,6 +17,15 @@ type Metrics struct {
|
|||||||
MemUsage int64
|
MemUsage int64
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func NewMetrics() Metrics {
|
||||||
|
return Metrics{
|
||||||
|
CPUUtil: -1,
|
||||||
|
NetTx: -1,
|
||||||
|
NetRx: -1,
|
||||||
|
MemUsage: -1,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
type Collector interface {
|
type Collector interface {
|
||||||
Stream() chan Metrics
|
Stream() chan Metrics
|
||||||
Running() bool
|
Running() bool
|
||||||
|
Loading…
Reference in New Issue
Block a user