Skip to content

Commit

Permalink
stats cmd should be robust enough to handle metrics with multiple lab…
Browse files Browse the repository at this point in the history
…els (#4941)

Signed-off-by: Changxin Miao <miaochangxin@step.ai>
  • Loading branch information
polyrabbit authored Jun 13, 2024
1 parent 398974d commit 40ac710
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion cmd/stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -360,10 +360,11 @@ func readStats(mp string) map[string]float64 {
for _, line := range lines {
fields := strings.Fields(line)
if len(fields) == 2 {
stats[fields[0]], err = strconv.ParseFloat(fields[1], 64)
v, err := strconv.ParseFloat(fields[1], 64)
if err != nil {
logger.Warnf("parse %s: %s", fields[1], err)
}
stats[fields[0]] += v
}
}
return stats
Expand Down

0 comments on commit 40ac710

Please sign in to comment.