Skip to content

Commit fbef498

Browse files
committed
fix out of range on empty datapoints
1 parent 5774656 commit fbef498

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

pkg/fiolog/parse.go

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -185,10 +185,15 @@ func ParseLogFile(fname string, aggregation Aggregation, maxDataPoints uint, tim
185185

186186
byDirection[idx] = make(LogMetrics, len(cacheAggregationData))
187187
for i := range cacheAggregationData {
188-
newMetric := aggregation.convert(&cacheAggregationData[i])
189-
// set newMetric time based on the point and interval
190-
newMetric.Time = uint(i) * interval
191-
byDirection[idx][i] = &newMetric
188+
metric := &cacheAggregationData[i]
189+
190+
// fix out of range if datapoint has no metrics
191+
if len(*metric) > 0 {
192+
newMetric := aggregation.convert(metric)
193+
// set newMetric time based on the point and interval
194+
newMetric.Time = uint(i) * interval
195+
byDirection[idx][i] = &newMetric
196+
}
192197
}
193198
}
194199
}

0 commit comments

Comments
 (0)