1
0
Fork 0
mirror of synced 2024-10-02 10:16:27 +13:00

addressing comments

This commit is contained in:
shimon 2023-02-06 14:54:37 +02:00
parent 84c233a2f1
commit 53a3223172
2 changed files with 12 additions and 7 deletions

View file

@ -56,6 +56,11 @@ class BuildsV1 extends Worker
}
}
/**
* @throws \Utopia\Database\Exception\Authorization
* @throws \Utopia\Database\Exception\Structure
* @throws Throwable
*/
protected function buildDeployment(Document $project, Document $function, Document $deployment)
{
global $register;
@ -171,8 +176,8 @@ class BuildsV1 extends Worker
try {
$response = $this->executor->createRuntime(
projectId: $project->getId(),
deploymentId: $deployment->getId(),
projectId: $project->getId(),
source: $source,
image: $runtime['image'],
remove: true,
@ -256,10 +261,10 @@ class BuildsV1 extends Worker
->setProject($project)
->addMetric(METRIC_BUILDS, 1) // per project
->addMetric(METRIC_BUILDS_STORAGE, $build->getAttribute('size', 0))
->addMetric(METRIC_BUILDS_COMPUTE, $build->getAttribute('duration', 0))
->addMetric(METRIC_BUILDS_COMPUTE, (int)$build->getAttribute('duration', 0) * 1000)
->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), $build->getAttribute('duration', 0))
->addMetric(str_replace('{functionInternalId}', $function->getInternalId(), METRIC_FUNCTION_ID_BUILDS_COMPUTE), (int)$build->getAttribute('duration', 0) * 1000)
->trigger()
;
}

8
composer.lock generated
View file

@ -1452,12 +1452,12 @@
"source": {
"type": "git",
"url": "https://github.com/utopia-php/database.git",
"reference": "ba9f0cea086fa7a8b4b613ef4afe41196fd7b4d1"
"reference": "e548c4b5c6f1d7cfc9ba0113fbeb8c4684eddcd2"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/utopia-php/database/zipball/ba9f0cea086fa7a8b4b613ef4afe41196fd7b4d1",
"reference": "ba9f0cea086fa7a8b4b613ef4afe41196fd7b4d1",
"url": "https://api.github.com/repos/utopia-php/database/zipball/e548c4b5c6f1d7cfc9ba0113fbeb8c4684eddcd2",
"reference": "e548c4b5c6f1d7cfc9ba0113fbeb8c4684eddcd2",
"shasum": ""
},
"require": {
@ -1499,7 +1499,7 @@
"issues": "https://github.com/utopia-php/database/issues",
"source": "https://github.com/utopia-php/database/tree/increment"
},
"time": "2023-02-02T08:34:12+00:00"
"time": "2023-02-05T10:33:42+00:00"
},
{
"name": "utopia-php/domains",