fix response and project usage issues
This commit is contained in:
parent
63371ce76e
commit
b5f5aff626
|
@ -276,13 +276,13 @@ App::get('/v1/projects/:projectId/usage')
|
|||
$dbForProject->setNamespace("_{$project->getInternalId()}");
|
||||
|
||||
$metrics = [
|
||||
'requests',
|
||||
'network',
|
||||
'executions',
|
||||
'users.count',
|
||||
'databases.documents.count',
|
||||
'databases.collections.count',
|
||||
'storage.total'
|
||||
'project.$all.network.requests',
|
||||
'project.$all.network.bandwidth',
|
||||
'executions.$all.compute.total',
|
||||
'users.$all.count.total',
|
||||
'documents.$all.count.total',
|
||||
'collections.$all.count.total',
|
||||
'project.$all.storage.size'
|
||||
];
|
||||
|
||||
$stats = [];
|
||||
|
@ -325,13 +325,13 @@ App::get('/v1/projects/:projectId/usage')
|
|||
|
||||
$usage = new Document([
|
||||
'range' => $range,
|
||||
'requests' => $stats['requests'],
|
||||
'network' => $stats['network'],
|
||||
'functions' => $stats['executions'],
|
||||
'documents' => $stats['databases.documents.count'],
|
||||
'collections' => $stats['databases.collections.count'],
|
||||
'users' => $stats['users.count'],
|
||||
'storage' => $stats['storage.total']
|
||||
'requests' => $stats[$metrics[0]],
|
||||
'network' => $stats[$metrics[1]],
|
||||
'executions' => $stats[$metrics[2]],
|
||||
'users' => $stats[$metrics[3]],
|
||||
'documents' => $stats[$metrics[4]],
|
||||
'collections' => $stats[$metrics[5]],
|
||||
'storage' => $stats[$metrics[6]],
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
|
@ -18,16 +18,16 @@ class TimeSeries extends Calculator
|
|||
// all the mertics that we are collecting
|
||||
protected array $metrics = [
|
||||
'project.$all.network.requests' => [
|
||||
'table' => 'appwrite_usage_network_{scope}_requests',
|
||||
'table' => 'appwrite_usage_project_{scope}_network_requests',
|
||||
],
|
||||
'project.$all.network.bandwidth' => [
|
||||
'table' => 'appwrite_usage_network_{scope}_bandwidth',
|
||||
'table' => 'appwrite_usage_project_{scope}_network_bandwidth',
|
||||
],
|
||||
'project.$all.network.inbound' => [
|
||||
'table' => 'appwrite_usage_network_{scope}_inbound',
|
||||
'table' => 'appwrite_usage_project_{scope}_network_inbound',
|
||||
],
|
||||
'project.$all.network.outbound' => [
|
||||
'table' => 'appwrite_usage_network_{scope}_outbound',
|
||||
'table' => 'appwrite_usage_project_{scope}_network_outbound',
|
||||
],
|
||||
/* Users service metrics */
|
||||
'users.$all.requests.create' => [
|
||||
|
|
|
@ -30,7 +30,7 @@ class UsageProject extends Model
|
|||
'example' => new \stdClass(),
|
||||
'array' => true
|
||||
])
|
||||
->addRule('functions', [
|
||||
->addRule('executions', [
|
||||
'type' => Response::MODEL_METRIC_LIST,
|
||||
'description' => 'Aggregated stats for function executions.',
|
||||
'default' => [],
|
||||
|
|
|
@ -59,7 +59,6 @@ class UsageTest extends Scope
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
sleep(35);
|
||||
|
||||
// console request
|
||||
|
|
Loading…
Reference in a new issue