Skip to content

Commit 0f0d72b

Browse files
authored
Merge pull request #152 from intel/noinf
filter out infinite values in metrics summary
2 parents 6242970 + 582ecfb commit 0f0d72b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

cmd/metrics/summary.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ func (m *metricsFromCSV) getStats() (stats map[string]metricStats, err error) {
223223
distanceSquaredSum := 0.0
224224
for _, row := range m.rows {
225225
val := row.metrics[metricName]
226-
if math.IsNaN(val) {
226+
if math.IsNaN(val) || math.IsInf(val, 0) {
227227
continue
228228
}
229229
distance := mean - val
@@ -312,7 +312,7 @@ func (m *metricsFromCSV) getHTML() (html string, err error) {
312312
if rIdx == 0 {
313313
firstTimestamp = row.timestamp
314314
}
315-
if math.IsNaN(row.metrics[tmpl.metricNames[archIndex]]) {
315+
if math.IsNaN(row.metrics[tmpl.metricNames[archIndex]]) || math.IsInf(row.metrics[tmpl.metricNames[archIndex]], 0) {
316316
continue
317317
}
318318
series = append(series, []float64{row.timestamp - firstTimestamp, row.metrics[tmpl.metricNames[archIndex]]})

0 commit comments

Comments
 (0)