Skip to content

Commit

Permalink
Merge branch 'master' into dependabot/go_modules/github.com/openconta…
Browse files Browse the repository at this point in the history
…iners/runc-1.0.3
  • Loading branch information
bcicen committed Jan 6, 2022
2 parents d8542c8 + da09b95 commit 1f91033
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
5 changes: 4 additions & 1 deletion connector/collector/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,10 @@ func (c *Docker) Stop() {
}

func (c *Docker) ReadCPU(stats *api.Stats) {
ncpus := uint8(len(stats.CPUStats.CPUUsage.PercpuUsage))
ncpus := uint8(stats.CPUStats.OnlineCPUs)
if ncpus == 0 {
ncpus = uint8(len(stats.CPUStats.CPUUsage.PercpuUsage))
}
total := float64(stats.CPUStats.CPUUsage.TotalUsage)
system := float64(stats.CPUStats.SystemCPUUsage)

Expand Down
6 changes: 5 additions & 1 deletion container/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,14 @@ type Container struct {

func New(id string, collector collector.Collector, manager manager.Manager) *Container {
widgets := compact.NewCompactRow()
shortID := id
if len(shortID) > 12 {
shortID = shortID[0:12]
}
return &Container{
Metrics: models.NewMetrics(),
Id: id,
Meta: models.NewMeta("id", id[:12]),
Meta: models.NewMeta("id", shortID),
Widgets: widgets,
updater: widgets,
collector: collector,
Expand Down

0 comments on commit 1f91033

Please sign in to comment.