1
0
Fork 0
mirror of synced 2024-06-03 03:14:50 +12:00

use same array for all metrics

This commit is contained in:
Damodar Lohani 2022-10-14 08:49:00 +00:00
parent 910c033d2a
commit e7e8c53d89

View file

@ -299,9 +299,6 @@ class TimeSeries extends Calculator
'table' => 'appwrite_usage_documents_{scope}_count_total',
'groupBy' => ['databaseId', 'collectionId']
],
];
protected array $cumulativeMetrics = [
'deployments.$all.storage.size' => [
'table' => 'appwrite_usage_deployments_{scope}_storage_size',
],
@ -315,14 +312,14 @@ class TimeSeries extends Calculator
'table' => 'appwrite_usage_files_{scope}_storage_size',
'groupBy' => ['bucketId']
],
'builds.$all.compute.time' => [
'table' => 'appwrite_usage_executions_{scope}_compute_time',
],
'executions.$all.compute.time' => [
'table' => 'appwrite_usage_executions_{scope}_compute_time',
],
'executions.functionId.compute.time' => [
'table' => 'appwrite_usage_executions_{scope}_compute_time',
'groupBy' => ['functionId'],
@ -331,7 +328,7 @@ class TimeSeries extends Calculator
'table' => 'appwrite_usage_builds_{scope}_compute_time',
'groupBy' => ['functionId'],
],
'project.$all.compute.time' => [ // Built time + execution time
'table' => 'appwrite_usage_project_{scope}_compute_time',
'groupBy' => ['functionId'],
@ -487,18 +484,5 @@ class TimeSeries extends Calculator
}
}
}
// for cumulative metrics only get hourly metrics from timeseries
foreach ($this->cumulativeMetrics as $metric => $options) {
try {
$this->syncFromInfluxDB($metric, $options, $this->periods[0]);
} catch (\Exception $e) {
if (is_callable($this->errorHandler)) {
call_user_func($this->errorHandler, $e);
} else {
throw $e;
}
}
}
}
}