mirror of
https://github.com/appwrite/appwrite.git
synced 2026-05-26 13:51:13 +00:00
Address Christy's comments
This commit is contained in:
@@ -11,8 +11,8 @@ return [
|
||||
'memory' => 1024,
|
||||
'cpus' => 1
|
||||
],
|
||||
Sizes::S_2VCPU_1GB->value => [
|
||||
'memory' => 1024,
|
||||
Sizes::S_2VCPU_2GB->value => [
|
||||
'memory' => 2048,
|
||||
'cpus' => 2
|
||||
],
|
||||
Sizes::S_2VCPU_4GB->value => [
|
||||
|
||||
@@ -1828,8 +1828,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) * $function->getAttribute('cpus', 1))
|
||||
->addMetric(str_replace('{functionInternalId}', $function->getInternalId(), METRIC_FUNCTION_ID_EXECUTIONS_MB_SECONDS), $function->getAttribute('memory') * $execution->getAttribute('duration', 0) * $function->getAttribute('cpus', 1))
|
||||
->addMetric(METRIC_EXECUTIONS_MB_SECONDS, $function->getAttribute('memory', 512) * $execution->getAttribute('duration', 0) * $function->getAttribute('cpus', 1))
|
||||
->addMetric(str_replace('{functionInternalId}', $function->getInternalId(), METRIC_FUNCTION_ID_EXECUTIONS_MB_SECONDS), $function->getAttribute('memory', 512) * $execution->getAttribute('duration', 0) * $function->getAttribute('cpus', 1))
|
||||
;
|
||||
|
||||
if ($function->getAttribute('logging')) {
|
||||
|
||||
@@ -410,8 +410,8 @@ class Builds extends Action
|
||||
source: $source,
|
||||
image: $runtime['image'],
|
||||
version: $version,
|
||||
cpus: 2,
|
||||
memory: 1024,
|
||||
cpus: $function->getAttribute('cpus', 1),
|
||||
memory: $function->getAttribute('memory', 512),
|
||||
remove: true,
|
||||
entrypoint: $deployment->getAttribute('entrypoint'),
|
||||
destination: APP_STORAGE_BUILDS . "/app-{$project->getId()}",
|
||||
@@ -542,11 +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) * $function->getAttribute('cpus', 1))
|
||||
->addMetric(METRIC_BUILDS_MB_SECONDS, $function->getAttribute('memory', 512) * $build->getAttribute('duration', 0) * $function->getAttribute('cpus', 1))
|
||||
->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) * $function->getAttribute('cpus', 1))
|
||||
->addMetric(str_replace('{functionInternalId}', $function->getInternalId(), METRIC_FUNCTION_ID_BUILDS_MB_SECONDS), $function->getAttribute('memory', 512) * $build->getAttribute('duration', 0) * $function->getAttribute('cpus', 1))
|
||||
->setProject($project)
|
||||
->trigger();
|
||||
}
|
||||
|
||||
@@ -509,8 +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) * $function->getAttribute('cpus', 1))
|
||||
->addMetric(str_replace('{functionInternalId}', $function->getInternalId(), METRIC_FUNCTION_ID_EXECUTIONS_MB_SECONDS), $function->getAttribute('memory') * $execution->getAttribute('duration', 0) * $function->getAttribute('cpus', 1))
|
||||
->addMetric(METRIC_EXECUTIONS_MB_SECONDS, $function->getAttribute('memory', 512) * $execution->getAttribute('duration', 0) * $function->getAttribute('cpus', 1))
|
||||
->addMetric(str_replace('{functionInternalId}', $function->getInternalId(), METRIC_FUNCTION_ID_EXECUTIONS_MB_SECONDS), $function->getAttribute('memory', 512) * $execution->getAttribute('duration', 0) * $function->getAttribute('cpus', 1))
|
||||
->trigger()
|
||||
;
|
||||
}
|
||||
|
||||
@@ -400,7 +400,6 @@ class FunctionsCustomServerTest extends Scope
|
||||
'users.*.update.name',
|
||||
'users.*.update.email',
|
||||
],
|
||||
'schedule' => '0 0 1 1 *',
|
||||
'timeout' => 15,
|
||||
'runtime' => 'php-8.0',
|
||||
'entrypoint' => 'index.php',
|
||||
@@ -418,7 +417,6 @@ class FunctionsCustomServerTest extends Scope
|
||||
'users.*.update.name',
|
||||
'users.*.update.email',
|
||||
], $response1['body']['events']);
|
||||
$this->assertEquals('0 0 1 1 *', $response1['body']['schedule']);
|
||||
$this->assertEquals(15, $response1['body']['timeout']);
|
||||
$this->assertEquals(1024, $response1['body']['memory']);
|
||||
$this->assertEquals(1, $response1['body']['cpus']);
|
||||
@@ -436,7 +434,6 @@ class FunctionsCustomServerTest extends Scope
|
||||
'users.*.update.name',
|
||||
'users.*.update.email',
|
||||
],
|
||||
'schedule' => '0 0 1 1 *',
|
||||
'timeout' => 15,
|
||||
'runtime' => 'php-8.0',
|
||||
'entrypoint' => 'index.php',
|
||||
@@ -444,6 +441,7 @@ class FunctionsCustomServerTest extends Scope
|
||||
]);
|
||||
|
||||
$this->assertEquals(400, $response2['headers']['status-code']);
|
||||
$this->assertEquals('Invalid `size` param: String must be a valid size value of s-1vcpu-512mb, s-1vcpu-1gb', $response2['body']['message']);
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user