Skip to content

Commit

Permalink
fix(linux/cpu): 🐛 add units to cpu usage count sensors
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuar committed Jan 25, 2025
1 parent 7c63100 commit 114a35f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion internal/linux/cpu/usageSensors.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ func newUsageSensor(clktck int64, details []string, category types.Category) sen
return usageSensor
}

func newCountSensor(name, icon, valueStr string) sensor.Entity {
func newCountSensor(name, icon, units, valueStr string) sensor.Entity {

Check failure on line 100 in internal/linux/cpu/usageSensors.go

View workflow job for this annotation

GitHub Actions / golangci

unused-parameter: parameter 'units' seems to be unused, consider removing or renaming it as _ (revive)
valueInt, _ := strconv.Atoi(valueStr) //nolint:errcheck // if we can't parse it, value will be 0.

return sensor.NewSensor(
Expand Down
4 changes: 2 additions & 2 deletions internal/linux/cpu/usageWorker.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,9 @@ func (w *usageWorker) getUsageStats() ([]sensor.Entity, error) {

sensors = append(sensors, *w.rateSensors["processes"].Entity)
case cols[0] == "procs_running":
sensors = append(sensors, newCountSensor("Processes Running", "mdi:application-cog", cols[1]))
sensors = append(sensors, newCountSensor("Processes Running", "mdi:application-cog", "processes", cols[1]))
case cols[0] == "procs_blocked":
sensors = append(sensors, newCountSensor("Processes Blocked", "mdi:application-cog", cols[1]))
sensors = append(sensors, newCountSensor("Processes Blocked", "mdi:application-cog", "processes", cols[1]))
}
}

Expand Down

0 comments on commit 114a35f

Please sign in to comment.