Skip to content

Commit

Permalink
initialize metrics with negative value prior to collector start
Browse files Browse the repository at this point in the history
  • Loading branch information
bcicen committed Feb 28, 2017
1 parent 69128f1 commit 2c198ae
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
5 changes: 3 additions & 2 deletions container.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ type Container struct {

func NewContainer(id, name string) *Container {
c := &Container{
id: id,
name: name,
id: id,
name: name,
metrics: metrics.NewMetrics(),
}
c.widgets = compact.NewCompact(c.ShortID(), c.ShortName(), c.state)
return c
Expand Down
9 changes: 9 additions & 0 deletions metrics/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,15 @@ type Metrics struct {
MemUsage int64
}

func NewMetrics() Metrics {
return Metrics{
CPUUtil: -1,
NetTx: -1,
NetRx: -1,
MemUsage: -1,
}
}

type Collector interface {
Stream() chan Metrics
Running() bool
Expand Down

0 comments on commit 2c198ae

Please sign in to comment.