Skip to content

Commit

Permalink
Revert check for CPUAccounting property.
Browse files Browse the repository at this point in the history
Signed-off-by: Nikolay Pelov <[email protected]>
  • Loading branch information
pelov committed Jan 26, 2023
1 parent 0afc9be commit 47d7e92
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions systemd/systemd.go
Original file line number Diff line number Diff line change
Expand Up @@ -609,6 +609,18 @@ func (c *Collector) collectUnitCPUUsageMetrics(unitType string, conn *dbus.Conn,
return nil
}

propCPUAcct, err := conn.GetUnitTypePropertyContext(c.ctx, unit.Name, unitType, "CPUAccounting")
if err != nil {
return errors.Wrapf(err, errGetPropertyMsg, "CPUAccounting")
}
cpuAcct, ok := propCPUAcct.Value.Value().(bool)
if !ok {
return errors.Errorf(errConvertStringPropertyMsg, "CPUAccounting", propCPUAcct.Value.Value())
}
if !cpuAcct {
return nil
}

cpuUsage, err := NewCPUUsage(cgSubpath, c.logger)
if err != nil {
if unitType == "Socket" {
Expand Down

0 comments on commit 47d7e92

Please sign in to comment.