1
0
Fork 0
mirror of synced 2024-07-01 20:50:49 +12:00

feat: add execution aggregation to project usage

This commit is contained in:
Torsten Dittmann 2023-12-12 18:48:21 +01:00
parent 3d081e1aa5
commit 063db1e2bf
10 changed files with 18 additions and 9 deletions

View file

@ -185,7 +185,7 @@ return [
[
'key' => 'web',
'name' => 'Console',
'version' => '0.4.1',
'version' => '0.4.2',
'url' => 'https://github.com/appwrite/sdk-for-console',
'package' => '',
'enabled' => true,
@ -195,7 +195,7 @@ return [
'family' => APP_PLATFORM_CONSOLE,
'prism' => 'javascript',
'source' => \realpath(__DIR__ . '/../sdks/console-web'),
'gitUrl' => 'git@github.com:appwrite/sdk-for-console.git',
'gitUrl' => 'https://github.com/appwrite/sdk-for-console.git',
'gitBranch' => 'dev',
'gitRepoName' => 'sdk-for-console',
'gitUserName' => 'appwrite',

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -52,6 +52,7 @@ App::get('/v1/project/usage')
METRIC_NETWORK_INBOUND,
METRIC_NETWORK_OUTBOUND,
METRIC_USERS,
METRIC_EXECUTIONS
]
];
@ -147,6 +148,7 @@ App::get('/v1/project/usage')
'requests' => ($usage[METRIC_NETWORK_REQUESTS]),
'network' => ($usage[METRIC_NETWORK_INBOUND] + $usage[METRIC_NETWORK_OUTBOUND]),
'users' => ($usage[METRIC_USERS]),
'executions' => ($usage[METRIC_EXECUTIONS]),
'executionsTotal' => $total[METRIC_EXECUTIONS],
'documentsTotal' => $total[METRIC_DOCUMENTS],
'databasesTotal' => $total[METRIC_DATABASES],

View file

@ -67,6 +67,13 @@ class UsageProject extends Model
'example' => [],
'array' => true
])
->addRule('executions', [
'type' => Response::MODEL_METRIC,
'description' => 'Aggregated number of executions per period.',
'default' => [],
'example' => [],
'array' => true
])
->addRule('executionsBreakdown', [
'type' => Response::MODEL_METRIC_BREAKDOWN,
'description' => 'Aggregated breakdown in totals of executions by functions.',

View file

@ -130,7 +130,7 @@ class UsageTest extends Scope
);
$res = $res['body'];
$this->assertEquals(11, count($res));
$this->assertEquals(12, count($res));
$this->validateDates($res['network']);
$this->validateDates($res['requests']);
$this->validateDates($res['users']);