From fce118ff34c6f2d14c3ee8b4f46503058f4f1731 Mon Sep 17 00:00:00 2001 From: Bradley Schofield Date: Fri, 12 Jul 2024 19:02:32 +0900 Subject: [PATCH 1/3] Move GBHours to 1.5.x --- app/controllers/api/functions.php | 14 ++++++ app/controllers/api/project.php | 44 ++++++++++++++++++- app/init.php | 4 ++ src/Appwrite/Platform/Workers/Builds.php | 2 + src/Appwrite/Platform/Workers/Functions.php | 2 + .../Utopia/Response/Model/UsageFunction.php | 27 +++++++++++- .../Utopia/Response/Model/UsageFunctions.php | 27 +++++++++++- .../Utopia/Response/Model/UsageProject.php | 26 +++++++++++ 8 files changed, 142 insertions(+), 4 deletions(-) diff --git a/app/controllers/api/functions.php b/app/controllers/api/functions.php index 489112a6c8..53b126591f 100644 --- a/app/controllers/api/functions.php +++ b/app/controllers/api/functions.php @@ -524,6 +524,8 @@ App::get('/v1/functions/:functionId/usage') str_replace('{functionInternalId}', $function->getInternalId(), METRIC_FUNCTION_ID_BUILDS_COMPUTE), str_replace('{functionInternalId}', $function->getInternalId(), METRIC_FUNCTION_ID_EXECUTIONS), str_replace('{functionInternalId}', $function->getInternalId(), METRIC_FUNCTION_ID_EXECUTIONS_COMPUTE), + str_replace('{functionInternalId}', $function->getInternalId(), METRIC_FUNCTION_ID_BUILDS_MB_SECONDS), + str_replace('{functionInternalId}', $function->getInternalId(), METRIC_FUNCTION_ID_EXECUTIONS_MB_SECONDS) ]; Authorization::skip(function () use ($dbForProject, $days, $metrics, &$stats) { @@ -586,6 +588,10 @@ App::get('/v1/functions/:functionId/usage') 'buildsTime' => $usage[$metrics[4]]['data'], 'executions' => $usage[$metrics[5]]['data'], 'executionsTime' => $usage[$metrics[6]]['data'], + 'buildsMbSecondsTotal' => $usage[$metrics[7]]['total'], + 'buildsMbSeconds' => $usage[$metrics[7]]['data'], + 'executionsMbSeconds' => $usage[$metrics[8]]['data'], + 'executionsMbSecondsTotal' => $usage[$metrics[8]]['total'], ]), Response::MODEL_USAGE_FUNCTION); }); @@ -616,6 +622,8 @@ App::get('/v1/functions/usage') METRIC_BUILDS_COMPUTE, METRIC_EXECUTIONS, METRIC_EXECUTIONS_COMPUTE, + METRIC_BUILDS_MB_SECONDS, + METRIC_EXECUTIONS_MB_SECONDS, ]; Authorization::skip(function () use ($dbForProject, $days, $metrics, &$stats) { @@ -679,6 +687,10 @@ App::get('/v1/functions/usage') 'buildsTime' => $usage[$metrics[5]]['data'], 'executions' => $usage[$metrics[6]]['data'], 'executionsTime' => $usage[$metrics[7]]['data'], + 'buildsMbSecondsTotal' => $usage[$metrics[8]]['total'], + 'buildsMbSeconds' => $usage[$metrics[8]]['data'], + 'executionsMbSeconds' => $usage[$metrics[9]]['data'], + 'executionsMbSecondsTotal' => $usage[$metrics[9]]['total'], ]), Response::MODEL_USAGE_FUNCTIONS); }); @@ -1803,6 +1815,8 @@ App::post('/v1/functions/:functionId/executions') ->addMetric(str_replace('{functionInternalId}', $function->getInternalId(), METRIC_FUNCTION_ID_EXECUTIONS), 1) ->addMetric(METRIC_EXECUTIONS_COMPUTE, (int)($execution->getAttribute('duration') * 1000)) // per project ->addMetric(str_replace('{functionInternalId}', $function->getInternalId(), METRIC_FUNCTION_ID_EXECUTIONS_COMPUTE), (int)($execution->getAttribute('duration') * 1000)) // per function + ->addMetric(METRIC_EXECUTIONS_MB_SECONDS, $function->getAttribute('memory') * $execution->getAttribute('duration', 0)) + ->addMetric(str_replace('{functionInternalId}', $function->getInternalId(), METRIC_FUNCTION_ID_EXECUTIONS_MB_SECONDS), $function->getAttribute('memory') * $execution->getAttribute('duration', 0)) ; if ($function->getAttribute('logging')) { diff --git a/app/controllers/api/project.php b/app/controllers/api/project.php index a3e07927d6..7094dc888d 100644 --- a/app/controllers/api/project.php +++ b/app/controllers/api/project.php @@ -40,6 +40,8 @@ App::get('/v1/project/usage') $metrics = [ 'total' => [ METRIC_EXECUTIONS, + METRIC_EXECUTIONS_MB_SECONDS, + METRIC_BUILDS_MB_SECONDS, METRIC_DOCUMENTS, METRIC_DATABASES, METRIC_USERS, @@ -51,7 +53,9 @@ App::get('/v1/project/usage') METRIC_NETWORK_INBOUND, METRIC_NETWORK_OUTBOUND, METRIC_USERS, - METRIC_EXECUTIONS + METRIC_EXECUTIONS, + METRIC_EXECUTIONS_MB_SECONDS, + METRIC_BUILDS_MB_SECONDS ] ]; @@ -128,6 +132,38 @@ App::get('/v1/project/usage') ]; }, $dbForProject->find('functions')); + $executionsMbSecondsBreakdown = array_map(function ($function) use ($dbForProject) { + $id = $function->getId(); + $name = $function->getAttribute('name'); + $metric = str_replace('{functionInternalId}', $function->getInternalId(), METRIC_FUNCTION_ID_EXECUTIONS_MB_SECONDS); + $value = $dbForProject->findOne('stats', [ + Query::equal('metric', [$metric]), + Query::equal('period', ['inf']) + ]); + + return [ + 'resourceId' => $id, + 'name' => $name, + 'value' => $value['value'] ?? 0, + ]; + }, $dbForProject->find('functions')); + + $buildsMbSecondsBreakdown = array_map(function ($function) use ($dbForProject) { + $id = $function->getId(); + $name = $function->getAttribute('name'); + $metric = str_replace('{functionInternalId}', $function->getInternalId(), METRIC_FUNCTION_ID_BUILDS_MB_SECONDS); + $value = $dbForProject->findOne('stats', [ + Query::equal('metric', [$metric]), + Query::equal('period', ['inf']) + ]); + + return [ + 'resourceId' => $id, + 'name' => $name, + 'value' => $value['value'] ?? 0, + ]; + }, $dbForProject->find('functions')); + $bucketsBreakdown = array_map(function ($bucket) use ($dbForProject) { $id = $bucket->getId(); $name = $bucket->getAttribute('name'); @@ -171,13 +207,17 @@ App::get('/v1/project/usage') 'users' => ($usage[METRIC_USERS]), 'executions' => ($usage[METRIC_EXECUTIONS]), 'executionsTotal' => $total[METRIC_EXECUTIONS], + 'executionsMbSecondsTotal' => $total[METRIC_EXECUTIONS_MB_SECONDS], + 'buildsMbSecondsTotal' => $total[METRIC_BUILDS_MB_SECONDS], 'documentsTotal' => $total[METRIC_DOCUMENTS], 'databasesTotal' => $total[METRIC_DATABASES], 'usersTotal' => $total[METRIC_USERS], 'bucketsTotal' => $total[METRIC_BUCKETS], 'filesStorageTotal' => $total[METRIC_FILES_STORAGE], 'executionsBreakdown' => $executionsBreakdown, - 'bucketsBreakdown' => $bucketsBreakdown + 'bucketsBreakdown' => $bucketsBreakdown, + 'executionsMbSecondsBreakdown' => $executionsMbSecondsBreakdown, + 'buildsMbSecondsBreakdown' => $buildsMbSecondsBreakdown, ]), Response::MODEL_USAGE_PROJECT); }); diff --git a/app/init.php b/app/init.php index 325c45a7e8..73d1b5f153 100644 --- a/app/init.php +++ b/app/init.php @@ -231,15 +231,19 @@ const METRIC_DEPLOYMENTS_STORAGE = 'deployments.storage'; const METRIC_BUILDS = 'builds'; const METRIC_BUILDS_STORAGE = 'builds.storage'; const METRIC_BUILDS_COMPUTE = 'builds.compute'; +const METRIC_BUILDS_MB_SECONDS = 'builds.mbSeconds'; const METRIC_FUNCTION_ID_BUILDS = '{functionInternalId}.builds'; const METRIC_FUNCTION_ID_BUILDS_STORAGE = '{functionInternalId}.builds.storage'; const METRIC_FUNCTION_ID_BUILDS_COMPUTE = '{functionInternalId}.builds.compute'; const METRIC_FUNCTION_ID_DEPLOYMENTS = '{resourceType}.{resourceInternalId}.deployments'; const METRIC_FUNCTION_ID_DEPLOYMENTS_STORAGE = '{resourceType}.{resourceInternalId}.deployments.storage'; +const METRIC_FUNCTION_ID_BUILDS_MB_SECONDS = '{functionInternalId}.builds.mbSeconds'; const METRIC_EXECUTIONS = 'executions'; const METRIC_EXECUTIONS_COMPUTE = 'executions.compute'; +const METRIC_EXECUTIONS_MB_SECONDS = 'executions.mbSeconds'; const METRIC_FUNCTION_ID_EXECUTIONS = '{functionInternalId}.executions'; const METRIC_FUNCTION_ID_EXECUTIONS_COMPUTE = '{functionInternalId}.executions.compute'; +const METRIC_FUNCTION_ID_EXECUTIONS_MB_SECONDS = '{functionInternalId}.executions.mbSeconds'; const METRIC_NETWORK_REQUESTS = 'network.requests'; const METRIC_NETWORK_INBOUND = 'network.inbound'; const METRIC_NETWORK_OUTBOUND = 'network.outbound'; diff --git a/src/Appwrite/Platform/Workers/Builds.php b/src/Appwrite/Platform/Workers/Builds.php index 8ade1106f5..6822d6e0c5 100644 --- a/src/Appwrite/Platform/Workers/Builds.php +++ b/src/Appwrite/Platform/Workers/Builds.php @@ -542,9 +542,11 @@ class Builds extends Action ->addMetric(METRIC_BUILDS, 1) // per project ->addMetric(METRIC_BUILDS_STORAGE, $build->getAttribute('size', 0)) ->addMetric(METRIC_BUILDS_COMPUTE, (int)$build->getAttribute('duration', 0) * 1000) + ->addMetric(METRIC_BUILDS_MB_SECONDS, $function->getAttribute('memory') * $build->getAttribute('duration', 0)) ->addMetric(str_replace('{functionInternalId}', $function->getInternalId(), METRIC_FUNCTION_ID_BUILDS), 1) // per function ->addMetric(str_replace('{functionInternalId}', $function->getInternalId(), METRIC_FUNCTION_ID_BUILDS_STORAGE), $build->getAttribute('size', 0)) ->addMetric(str_replace('{functionInternalId}', $function->getInternalId(), METRIC_FUNCTION_ID_BUILDS_COMPUTE), (int)$build->getAttribute('duration', 0) * 1000) + ->addMetric(str_replace('{functionInternalId}', $function->getInternalId(), METRIC_FUNCTION_ID_BUILDS_MB_SECONDS), $function->getAttribute('memory') * $build->getAttribute('duration', 0)) ->setProject($project) ->trigger(); } diff --git a/src/Appwrite/Platform/Workers/Functions.php b/src/Appwrite/Platform/Workers/Functions.php index f33cc6c855..16679bba30 100644 --- a/src/Appwrite/Platform/Workers/Functions.php +++ b/src/Appwrite/Platform/Workers/Functions.php @@ -509,6 +509,8 @@ class Functions extends Action ->addMetric(str_replace('{functionInternalId}', $function->getInternalId(), METRIC_FUNCTION_ID_EXECUTIONS), 1) ->addMetric(METRIC_EXECUTIONS_COMPUTE, (int)($execution->getAttribute('duration') * 1000))// per project ->addMetric(str_replace('{functionInternalId}', $function->getInternalId(), METRIC_FUNCTION_ID_EXECUTIONS_COMPUTE), (int)($execution->getAttribute('duration') * 1000)) + ->addMetric(METRIC_EXECUTIONS_MB_SECONDS, $function->getAttribute('memory') * $execution->getAttribute('duration', 0)) + ->addMetric(str_replace('{functionInternalId}', $function->getInternalId(), METRIC_FUNCTION_ID_EXECUTIONS_MB_SECONDS), $function->getAttribute('memory') * $execution->getAttribute('duration', 0)) ->trigger() ; } diff --git a/src/Appwrite/Utopia/Response/Model/UsageFunction.php b/src/Appwrite/Utopia/Response/Model/UsageFunction.php index 5a17fd154c..ac21c5ae0d 100644 --- a/src/Appwrite/Utopia/Response/Model/UsageFunction.php +++ b/src/Appwrite/Utopia/Response/Model/UsageFunction.php @@ -46,6 +46,12 @@ class UsageFunction extends Model 'default' => 0, 'example' => 0, ]) + ->addRule('buildsMbSecondsTotal', [ + 'type' => self::TYPE_INTEGER, + 'description' => 'Total aggregated sum of function builds mbSeconds.', + 'default' => 0, + 'example' => 0, + ]) ->addRule('executionsTotal', [ 'type' => self::TYPE_INTEGER, 'description' => 'Total aggregated number of function executions.', @@ -58,6 +64,12 @@ class UsageFunction extends Model 'default' => 0, 'example' => 0, ]) + ->addRule('executionsMbSecondsTotal', [ + 'type' => self::TYPE_INTEGER, + 'description' => 'Total aggregated sum of function executions mbSeconds.', + 'default' => 0, + 'example' => 0, + ]) ->addRule('deployments', [ 'type' => Response::MODEL_METRIC, 'description' => 'Aggregated number of function deployments per period.', @@ -93,6 +105,13 @@ class UsageFunction extends Model 'example' => [], 'array' => true ]) + ->addRule('buildsMbSeconds', [ + 'type' => Response::MODEL_METRIC, + 'description' => 'Aggregated number of function builds mbSeconds per period.', + 'default' => [], + 'example' => [], + 'array' => true + ]) ->addRule('executions', [ 'type' => Response::MODEL_METRIC, 'description' => 'Aggregated number of function executions per period.', @@ -100,7 +119,6 @@ class UsageFunction extends Model 'example' => [], 'array' => true ]) - ->addRule('executionsTime', [ 'type' => Response::MODEL_METRIC, 'description' => 'Aggregated number of function executions compute time per period.', @@ -108,6 +126,13 @@ class UsageFunction extends Model 'example' => [], 'array' => true ]) + ->addRule('executionsMbSeconds', [ + 'type' => Response::MODEL_METRIC, + 'description' => 'Aggregated number of function mbSeconds per period.', + 'default' => [], + 'example' => [], + 'array' => true + ]) ; } diff --git a/src/Appwrite/Utopia/Response/Model/UsageFunctions.php b/src/Appwrite/Utopia/Response/Model/UsageFunctions.php index f5bc251d45..90327a7e8a 100644 --- a/src/Appwrite/Utopia/Response/Model/UsageFunctions.php +++ b/src/Appwrite/Utopia/Response/Model/UsageFunctions.php @@ -52,6 +52,12 @@ class UsageFunctions extends Model 'default' => 0, 'example' => 0, ]) + ->addRule('buildsMbSecondsTotal', [ + 'type' => self::TYPE_INTEGER, + 'description' => 'Total aggregated sum of functions build mbSeconds.', + 'default' => 0, + 'example' => 0, + ]) ->addRule('executionsTotal', [ 'type' => self::TYPE_INTEGER, 'description' => 'Total aggregated number of functions execution.', @@ -64,6 +70,12 @@ class UsageFunctions extends Model 'default' => 0, 'example' => 0, ]) + ->addRule('executionsMbSecondsTotal', [ + 'type' => self::TYPE_INTEGER, + 'description' => 'Total aggregated sum of functions execution mbSeconds.', + 'default' => 0, + 'example' => 0, + ]) ->addRule('functions', [ 'type' => Response::MODEL_METRIC, 'description' => 'Aggregated number of functions per period.', @@ -106,6 +118,13 @@ class UsageFunctions extends Model 'example' => [], 'array' => true ]) + ->addRule('buildsMbSeconds', [ + 'type' => Response::MODEL_METRIC, + 'description' => 'Aggregated sum of functions build mbSeconds per period.', + 'default' => [], + 'example' => [], + 'array' => true + ]) ->addRule('executions', [ 'type' => Response::MODEL_METRIC, 'description' => 'Aggregated number of functions execution per period.', @@ -113,7 +132,6 @@ class UsageFunctions extends Model 'example' => [], 'array' => true ]) - ->addRule('executionsTime', [ 'type' => Response::MODEL_METRIC, 'description' => 'Aggregated number of functions execution compute time per period.', @@ -121,6 +139,13 @@ class UsageFunctions extends Model 'example' => [], 'array' => true ]) + ->addRule('executionsMbSeconds', [ + 'type' => Response::MODEL_METRIC, + 'description' => 'Aggregated number of functions mbSeconds per period.', + 'default' => [], + 'example' => [], + 'array' => true + ]) ; } diff --git a/src/Appwrite/Utopia/Response/Model/UsageProject.php b/src/Appwrite/Utopia/Response/Model/UsageProject.php index b3aaac2a6c..df1996c05f 100644 --- a/src/Appwrite/Utopia/Response/Model/UsageProject.php +++ b/src/Appwrite/Utopia/Response/Model/UsageProject.php @@ -46,6 +46,18 @@ class UsageProject extends Model 'default' => 0, 'example' => 0, ]) + ->addRule('executionsMbSecondsTotal', [ + 'type' => self::TYPE_INTEGER, + 'description' => 'Total aggregated number of function executions mbSeconds.', + 'default' => 0, + 'example' => 0, + ]) + ->addRule('buildsMbSecondsTotal', [ + 'type' => self::TYPE_INTEGER, + 'description' => 'Total aggregated number of function builds mbSeconds.', + 'default' => 0, + 'example' => 0, + ]) ->addRule('requests', [ 'type' => Response::MODEL_METRIC, 'description' => 'Aggregated number of requests per period.', @@ -88,6 +100,20 @@ class UsageProject extends Model 'example' => [], 'array' => true ]) + ->addRule('executionsMbSecondsBreakdown', [ + 'type' => Response::MODEL_METRIC_BREAKDOWN, + 'description' => 'Aggregated breakdown in totals of execution mbSeconds by functions.', + 'default' => [], + 'example' => [], + 'array' => true + ]) + ->addRule('buildsMbSecondsBreakdown', [ + 'type' => Response::MODEL_METRIC_BREAKDOWN, + 'description' => 'Aggregated breakdown in totals of build mbSeconds by functions.', + 'default' => [], + 'example' => [], + 'array' => true + ]) ; } From 8ef309a4aaf7151a994ee5186ae7b4aa5da1fb6e Mon Sep 17 00:00:00 2001 From: Bradley Schofield Date: Mon, 15 Jul 2024 11:59:02 +0900 Subject: [PATCH 2/3] Run Linter --- app/controllers/api/functions.php | 2 +- src/Appwrite/Platform/Workers/Functions.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/api/functions.php b/app/controllers/api/functions.php index 53b126591f..8ccf0632bb 100644 --- a/app/controllers/api/functions.php +++ b/app/controllers/api/functions.php @@ -1816,7 +1816,7 @@ App::post('/v1/functions/:functionId/executions') ->addMetric(METRIC_EXECUTIONS_COMPUTE, (int)($execution->getAttribute('duration') * 1000)) // per project ->addMetric(str_replace('{functionInternalId}', $function->getInternalId(), METRIC_FUNCTION_ID_EXECUTIONS_COMPUTE), (int)($execution->getAttribute('duration') * 1000)) // per function ->addMetric(METRIC_EXECUTIONS_MB_SECONDS, $function->getAttribute('memory') * $execution->getAttribute('duration', 0)) - ->addMetric(str_replace('{functionInternalId}', $function->getInternalId(), METRIC_FUNCTION_ID_EXECUTIONS_MB_SECONDS), $function->getAttribute('memory') * $execution->getAttribute('duration', 0)) + ->addMetric(str_replace('{functionInternalId}', $function->getInternalId(), METRIC_FUNCTION_ID_EXECUTIONS_MB_SECONDS), $function->getAttribute('memory') * $execution->getAttribute('duration', 0)) ; if ($function->getAttribute('logging')) { diff --git a/src/Appwrite/Platform/Workers/Functions.php b/src/Appwrite/Platform/Workers/Functions.php index 16679bba30..e8412f70c8 100644 --- a/src/Appwrite/Platform/Workers/Functions.php +++ b/src/Appwrite/Platform/Workers/Functions.php @@ -510,7 +510,7 @@ class Functions extends Action ->addMetric(METRIC_EXECUTIONS_COMPUTE, (int)($execution->getAttribute('duration') * 1000))// per project ->addMetric(str_replace('{functionInternalId}', $function->getInternalId(), METRIC_FUNCTION_ID_EXECUTIONS_COMPUTE), (int)($execution->getAttribute('duration') * 1000)) ->addMetric(METRIC_EXECUTIONS_MB_SECONDS, $function->getAttribute('memory') * $execution->getAttribute('duration', 0)) - ->addMetric(str_replace('{functionInternalId}', $function->getInternalId(), METRIC_FUNCTION_ID_EXECUTIONS_MB_SECONDS), $function->getAttribute('memory') * $execution->getAttribute('duration', 0)) + ->addMetric(str_replace('{functionInternalId}', $function->getInternalId(), METRIC_FUNCTION_ID_EXECUTIONS_MB_SECONDS), $function->getAttribute('memory') * $execution->getAttribute('duration', 0)) ->trigger() ; } From 98ae495879456f2c9f02e962a1a83138e8076ecd Mon Sep 17 00:00:00 2001 From: Bradley Schofield Date: Mon, 15 Jul 2024 12:54:59 +0900 Subject: [PATCH 3/3] Fix Tests --- tests/e2e/General/UsageTest.php | 12 +++++++----- .../Functions/FunctionsConsoleClientTest.php | 7 +++++-- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/tests/e2e/General/UsageTest.php b/tests/e2e/General/UsageTest.php index 59df8b6420..a6394fc75f 100644 --- a/tests/e2e/General/UsageTest.php +++ b/tests/e2e/General/UsageTest.php @@ -140,7 +140,7 @@ class UsageTest extends Scope ); $this->assertEquals(200, $response['headers']['status-code']); - $this->assertEquals(12, count($response['body'])); + $this->assertEquals(16, count($response['body'])); $this->validateDates($response['body']['network']); $this->validateDates($response['body']['requests']); $this->validateDates($response['body']['users']); @@ -321,7 +321,7 @@ class UsageTest extends Scope ] ); - $this->assertEquals(12, count($response['body'])); + $this->assertEquals(16, count($response['body'])); $this->assertEquals(1, count($response['body']['requests'])); $this->assertEquals($requestsTotal, $response['body']['requests'][array_key_last($response['body']['requests'])]['value']); $this->validateDates($response['body']['requests']); @@ -542,7 +542,7 @@ class UsageTest extends Scope ] ); - $this->assertEquals(12, count($response['body'])); + $this->assertEquals(16, count($response['body'])); $this->assertEquals(1, count($response['body']['requests'])); $this->assertEquals(1, count($response['body']['network'])); $this->assertEquals($requestsTotal, $response['body']['requests'][array_key_last($response['body']['requests'])]['value']); @@ -774,7 +774,7 @@ class UsageTest extends Scope ); $this->assertEquals(200, $response['headers']['status-code']); - $this->assertEquals(15, count($response['body'])); + $this->assertEquals(19, count($response['body'])); $this->assertEquals('30d', $response['body']['range']); $this->assertIsArray($response['body']['deployments']); $this->assertIsArray($response['body']['deploymentsStorage']); @@ -794,15 +794,17 @@ class UsageTest extends Scope ); $this->assertEquals(200, $response['headers']['status-code']); - $this->assertEquals(17, count($response['body'])); + $this->assertEquals(21, count($response['body'])); $this->assertEquals($response['body']['range'], '30d'); $this->assertIsArray($response['body']['functions']); $this->assertIsArray($response['body']['deployments']); $this->assertIsArray($response['body']['deploymentsStorage']); $this->assertIsArray($response['body']['builds']); $this->assertIsArray($response['body']['buildsTime']); + $this->assertIsArray($response['body']['buildsMbSeconds']); $this->assertIsArray($response['body']['executions']); $this->assertIsArray($response['body']['executionsTime']); + $this->assertIsArray($response['body']['executionsMbSeconds']); $this->assertEquals($executions, $response['body']['executions'][array_key_last($response['body']['executions'])]['value']); $this->validateDates($response['body']['executions']); $this->assertEquals($executionTime, $response['body']['executionsTime'][array_key_last($response['body']['executionsTime'])]['value']); diff --git a/tests/e2e/Services/Functions/FunctionsConsoleClientTest.php b/tests/e2e/Services/Functions/FunctionsConsoleClientTest.php index f72405008d..f58a698452 100644 --- a/tests/e2e/Services/Functions/FunctionsConsoleClientTest.php +++ b/tests/e2e/Services/Functions/FunctionsConsoleClientTest.php @@ -92,23 +92,26 @@ class FunctionsConsoleClientTest extends Scope ]); $this->assertEquals(200, $response['headers']['status-code']); - $this->assertEquals(15, count($response['body'])); + $this->assertEquals(19, count($response['body'])); $this->assertEquals('24h', $response['body']['range']); $this->assertIsNumeric($response['body']['deploymentsTotal']); $this->assertIsNumeric($response['body']['deploymentsStorageTotal']); $this->assertIsNumeric($response['body']['buildsTotal']); $this->assertIsNumeric($response['body']['buildsStorageTotal']); $this->assertIsNumeric($response['body']['buildsTimeTotal']); + $this->assertIsNumeric($response['body']['buildsMbSecondsTotal']); $this->assertIsNumeric($response['body']['executionsTotal']); $this->assertIsNumeric($response['body']['executionsTimeTotal']); + $this->assertIsNumeric($response['body']['executionsMbSecondsTotal']); $this->assertIsArray($response['body']['deployments']); $this->assertIsArray($response['body']['deploymentsStorage']); $this->assertIsArray($response['body']['builds']); $this->assertIsArray($response['body']['buildsTime']); $this->assertIsArray($response['body']['buildsStorage']); - $this->assertIsArray($response['body']['buildsTime']); + $this->assertIsArray($response['body']['buildsMbSeconds']); $this->assertIsArray($response['body']['executions']); $this->assertIsArray($response['body']['executionsTime']); + $this->assertIsArray($response['body']['executionsMbSeconds']); } /**