Use correct key in metrics array
This commit is contained in:
parent
79b1fceaf3
commit
6e46e2fb0f
|
@ -349,7 +349,7 @@ App::get('/v1/database/usage')
|
|||
};
|
||||
$stats[$metric][] = [
|
||||
'value' => 0,
|
||||
'date' => $stats[$metric][$last]['time'] - $diff, // time of last metric minus period
|
||||
'date' => ($stats[$metric][$last]['date'] ?? \time()) - $diff, // time of last metric minus period
|
||||
];
|
||||
$backfill--;
|
||||
}
|
||||
|
@ -461,7 +461,7 @@ App::get('/v1/database/:collectionId/usage')
|
|||
};
|
||||
$stats[$metric][] = [
|
||||
'value' => 0,
|
||||
'date' => $stats[$metric][$last]['time'] - $diff, // time of last metric minus period
|
||||
'date' => ($stats[$metric][$last]['date'] ?? \time()) - $diff, // time of last metric minus period
|
||||
];
|
||||
$backfill--;
|
||||
}
|
||||
|
|
|
@ -231,7 +231,7 @@ App::get('/v1/functions/:functionId/usage')
|
|||
};
|
||||
$stats[$metric][] = [
|
||||
'value' => 0,
|
||||
'date' => $stats[$metric][$last]['time'] - $diff, // time of last metric minus period
|
||||
'date' => ($stats[$metric][$last]['date'] ?? \time()) - $diff, // time of last metric minus period
|
||||
];
|
||||
$backfill--;
|
||||
}
|
||||
|
|
|
@ -316,7 +316,7 @@ App::get('/v1/projects/:projectId/usage')
|
|||
};
|
||||
$stats[$metric][] = [
|
||||
'value' => 0,
|
||||
'date' => $stats[$metric][$last]['time'] - $diff, // time of last metric minus period
|
||||
'date' => ($stats[$metric][$last]['date'] ?? \time()) - $diff, // time of last metric minus period
|
||||
];
|
||||
$backfill--;
|
||||
}
|
||||
|
|
|
@ -724,7 +724,7 @@ App::get('/v1/storage/usage')
|
|||
};
|
||||
$stats[$metric][] = [
|
||||
'value' => 0,
|
||||
'date' => $stats[$metric][$last]['time'] - $diff, // time of last metric minus period
|
||||
'date' => ($stats[$metric][$last]['date'] ?? \time()) - $diff, // time of last metric minus period
|
||||
];
|
||||
$backfill--;
|
||||
}
|
||||
|
@ -821,7 +821,7 @@ App::get('/v1/storage/:bucketId/usage')
|
|||
};
|
||||
$stats[$metric][] = [
|
||||
'value' => 0,
|
||||
'date' => $stats[$metric][$last]['time'] - $diff, // time of last metric minus period
|
||||
'date' => ($stats[$metric][$last]['date'] ?? \time()) - $diff, // time of last metric minus period
|
||||
];
|
||||
$backfill--;
|
||||
}
|
||||
|
|
|
@ -833,6 +833,7 @@ App::get('/v1/users/usage')
|
|||
// backfill metrics with empty values for graphs
|
||||
$backfill = $limit - \count($requestDocs);
|
||||
while ($backfill > 0) {
|
||||
|
||||
$last = $limit - $backfill - 1; // array index of last added metric
|
||||
$diff = match($period) { // convert period to seconds for unix timestamp math
|
||||
'30m' => 1800,
|
||||
|
@ -840,7 +841,7 @@ App::get('/v1/users/usage')
|
|||
};
|
||||
$stats[$metric][] = [
|
||||
'value' => 0,
|
||||
'date' => $stats[$metric][$last]['time'] - $diff, // time of last metric minus period
|
||||
'date' => ($stats[$metric][$last]['date'] ?? \time()) - $diff, // time of last metric minus period
|
||||
];
|
||||
$backfill--;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue