Skip to content

Commit

Permalink
Do not try to setup the root container.
Browse files Browse the repository at this point in the history
Signed-off-by: Paweł Szulik <pawel.szulik@intel.com>
  • Loading branch information
Paweł Szulik committed Mar 15, 2021
1 parent 1a4f1f6 commit df6d638
Showing 1 changed file with 27 additions and 24 deletions.
51 changes: 27 additions & 24 deletions resctrl/collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,34 +40,37 @@ func newCollector(id string, getContainerPids func() ([]string, error), interval
}

func (c *collector) setup() error {
err := c.prepareMonGroup()
if c.id != rootContainer {
// There is no need to prepare or update "/" container.
err := c.prepareMonGroup()

if c.interval != 0 && c.id != rootContainer {
if err != nil {
klog.Errorf("Failed to setup container %q resctrl collector: %v \n Trying again in next intervals!", c.id, err)
}
go func() {
for {
if c.running {
err = c.prepareMonGroup()
if err != nil {
klog.Errorf("checking %q resctrl collector but: %v", c.id, err)
}
} else {
err = c.clear()
if err != nil {
klog.Errorf("trying to end %q resctrl collector interval but: %v", c.id, err)
if c.interval != 0 {
if err != nil {
klog.Errorf("Failed to setup container %q resctrl collector: %w \n Trying again in next intervals!", c.id, err)
}
go func() {
for {
time.Sleep(c.interval)
if c.running {
err = c.prepareMonGroup()
if err != nil {
klog.Errorf("checking %q resctrl collector but: %w", c.id, err)
}
} else {
err = c.clear()
if err != nil {
klog.Errorf("trying to end %q resctrl collector interval but: %w", c.id, err)
}
break
}
break
}
time.Sleep(c.interval)
}()
} else {
// There is no interval set, if setup fail, stop.
if err != nil {
c.running = false
return err
}
}()
} else {
// There is no interval set, if setup fail, stop.
if err != nil {
c.running = false
return err
}
}

Expand Down

0 comments on commit df6d638

Please sign in to comment.