Align: do not append points with the same timestamp
This commit is contained in:
@@ -40,7 +40,12 @@ func (ts TimeSeries) Align(interval time.Duration) TimeSeries {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if len(alignedTs) > 0 && alignedTs[len(alignedTs)-1].Time == pointFrameTs {
|
||||||
|
// Do not append points with the same timestamp
|
||||||
|
alignedTs[len(alignedTs)-1] = TimePoint{Time: pointFrameTs, Value: point.Value}
|
||||||
|
} else {
|
||||||
alignedTs = append(alignedTs, TimePoint{Time: pointFrameTs, Value: point.Value})
|
alignedTs = append(alignedTs, TimePoint{Time: pointFrameTs, Value: point.Value})
|
||||||
|
}
|
||||||
frameTs = frameTs.Add(interval)
|
frameTs = frameTs.Add(interval)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user