Skip to content

Commit

Permalink
fix: Fix fill empty metrics algorithm
Browse files Browse the repository at this point in the history
Signed-off-by: leoliu <leoliu@yunify.com>
  • Loading branch information
leoliu committed Jul 27, 2020
1 parent 19aac12 commit 6840472
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/utils/monitoring.js
Original file line number Diff line number Diff line change
Expand Up @@ -381,10 +381,18 @@ export const fillEmptyMetrics = (params, result) => {
{}
)

let startTime
if (curValues[0] && curValues[0][0]) {
startTime =
params.start - step + ((curValues[0][0] - params.start) % step)
} else {
startTime = params.start
}

if (curValues.length < correctCount) {
const newValues = []
for (let index = 0; index < correctCount; index++) {
const time = format(params.start + index * step)
const time = format(startTime + index * step)
newValues.push([time, curValuesMap[time] || '0'])
}
resultItem.values = newValues
Expand Down

0 comments on commit 6840472

Please sign in to comment.