fix usage for tags -> deployments
This commit is contained in:
parent
0d3b627176
commit
789d5d33ab
1 changed files with 5 additions and 5 deletions
|
@ -416,17 +416,17 @@ $cli
|
||||||
|
|
||||||
// Get total storage
|
// Get total storage
|
||||||
$dbForProject->setNamespace('_project_' . $projectId);
|
$dbForProject->setNamespace('_project_' . $projectId);
|
||||||
$storageTotal = $dbForProject->sum('tags', 'size');
|
$storageTotal = $dbForProject->sum('deployments', 'size');
|
||||||
|
|
||||||
$time = (int) (floor(time() / 1800) * 1800); // Time rounded to nearest 30 minutes
|
$time = (int) (floor(time() / 1800) * 1800); // Time rounded to nearest 30 minutes
|
||||||
$id = \md5($time . '_30m_storage.tags.total'); //Construct unique id for each metric using time, period and metric
|
$id = \md5($time . '_30m_storage.deployments.total'); //Construct unique id for each metric using time, period and metric
|
||||||
$document = $dbForProject->getDocument('stats', $id);
|
$document = $dbForProject->getDocument('stats', $id);
|
||||||
if ($document->isEmpty()) {
|
if ($document->isEmpty()) {
|
||||||
$dbForProject->createDocument('stats', new Document([
|
$dbForProject->createDocument('stats', new Document([
|
||||||
'$id' => $id,
|
'$id' => $id,
|
||||||
'period' => '30m',
|
'period' => '30m',
|
||||||
'time' => $time,
|
'time' => $time,
|
||||||
'metric' => 'storage.tags.total',
|
'metric' => 'storage.deployments.total',
|
||||||
'value' => $storageTotal,
|
'value' => $storageTotal,
|
||||||
'type' => 1,
|
'type' => 1,
|
||||||
]));
|
]));
|
||||||
|
@ -439,14 +439,14 @@ $cli
|
||||||
}
|
}
|
||||||
|
|
||||||
$time = (int) (floor(time() / 86400) * 86400); // Time rounded to nearest day
|
$time = (int) (floor(time() / 86400) * 86400); // Time rounded to nearest day
|
||||||
$id = \md5($time . '_1d_storage.tags.total'); //Construct unique id for each metric using time, period and metric
|
$id = \md5($time . '_1d_storage.deployments.total'); //Construct unique id for each metric using time, period and metric
|
||||||
$document = $dbForProject->getDocument('stats', $id);
|
$document = $dbForProject->getDocument('stats', $id);
|
||||||
if ($document->isEmpty()) {
|
if ($document->isEmpty()) {
|
||||||
$dbForProject->createDocument('stats', new Document([
|
$dbForProject->createDocument('stats', new Document([
|
||||||
'$id' => $id,
|
'$id' => $id,
|
||||||
'period' => '1d',
|
'period' => '1d',
|
||||||
'time' => $time,
|
'time' => $time,
|
||||||
'metric' => 'storage.tags.total',
|
'metric' => 'storage.deployments.total',
|
||||||
'value' => $storageTotal,
|
'value' => $storageTotal,
|
||||||
'type' => 1,
|
'type' => 1,
|
||||||
]));
|
]));
|
||||||
|
|
Loading…
Reference in a new issue