Skip to content

Commit

Permalink
Merge pull request #152 from intel/noinf
Browse files Browse the repository at this point in the history
filter out infinite values in metrics summary
  • Loading branch information
harp-intel authored Jan 13, 2025
2 parents 6242970 + 582ecfb commit 0f0d72b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cmd/metrics/summary.go
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ func (m *metricsFromCSV) getStats() (stats map[string]metricStats, err error) {
distanceSquaredSum := 0.0
for _, row := range m.rows {
val := row.metrics[metricName]
if math.IsNaN(val) {
if math.IsNaN(val) || math.IsInf(val, 0) {
continue
}
distance := mean - val
Expand Down Expand Up @@ -312,7 +312,7 @@ func (m *metricsFromCSV) getHTML() (html string, err error) {
if rIdx == 0 {
firstTimestamp = row.timestamp
}
if math.IsNaN(row.metrics[tmpl.metricNames[archIndex]]) {
if math.IsNaN(row.metrics[tmpl.metricNames[archIndex]]) || math.IsInf(row.metrics[tmpl.metricNames[archIndex]], 0) {
continue
}
series = append(series, []float64{row.timestamp - firstTimestamp, row.metrics[tmpl.metricNames[archIndex]]})
Expand Down

0 comments on commit 0f0d72b

Please sign in to comment.