Merge branch 'master' into dependabot/go_modules/github.com/opencontainers/runc-1.0.3

This commit is contained in:
Bradley Cicenas 2022-01-06 17:13:20 -05:00
commit 1f91033beb
2 changed files with 9 additions and 2 deletions

View File

@ -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)

View File

@ -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,