From 499eb0c3def7b49103be73eef68eb7e1de6424e7 Mon Sep 17 00:00:00 2001 From: shimon Date: Wed, 4 Oct 2023 17:40:16 +0300 Subject: [PATCH] sync with 1.4 --- app/console | 2 +- app/controllers/api/functions.php | 2 ++ app/workers/functions.php | 10 +++------- composer.lock | 18 ++++++++++-------- src/Executor/Executor.php | 2 +- 5 files changed, 17 insertions(+), 17 deletions(-) diff --git a/app/console b/app/console index c57a776730..9b4bcb8140 160000 --- a/app/console +++ b/app/console @@ -1 +1 @@ -Subproject commit c57a776730fff4f11b36de70d53514a7614753aa +Subproject commit 9b4bcb8140484669421685b4ba89fa1c4d331360 diff --git a/app/controllers/api/functions.php b/app/controllers/api/functions.php index 5e8ba99982..1e06b14932 100644 --- a/app/controllers/api/functions.php +++ b/app/controllers/api/functions.php @@ -1678,6 +1678,8 @@ App::post('/v1/functions/:functionId/executions') * Sync execution compute usage from */ $queueForUsage + ->addMetric(METRIC_EXECUTIONS, 1) + ->addMetric(str_replace('{functionInternalId}', $function->getInternalId(), METRIC_FUNCTION_ID_EXECUTIONS), 1) ->addMetric(METRIC_EXECUTIONS_COMPUTE, (int)($executionResponse['duration'] * 1000)) // per project ->addMetric(str_replace('{functionInternalId}', $function->getInternalId(), METRIC_FUNCTION_ID_EXECUTIONS_COMPUTE), (int)($executionResponse['duration'] * 1000)) // per function ; diff --git a/app/workers/functions.php b/app/workers/functions.php index c02460262d..b00561c760 100644 --- a/app/workers/functions.php +++ b/app/workers/functions.php @@ -130,13 +130,7 @@ Server::setResource('execute', function () { throw new Exception('Failed to create or read execution'); } - /** - * Usage - */ - $queueForUsage - ->addMetric(METRIC_EXECUTIONS, 1) // per project - ->addMetric(str_replace('{functionInternalId}', $function->getInternalId(), METRIC_FUNCTION_ID_EXECUTIONS), 1); // per function } if ($execution->getAttribute('status') !== 'processing') { @@ -289,7 +283,9 @@ Server::setResource('execute', function () { /** Trigger usage queue */ $queueForUsage ->setProject($project) - ->addMetric(METRIC_EXECUTIONS_COMPUTE, (int)($execution->getAttribute('duration') * 1000))// per project + ->addMetric(METRIC_EXECUTIONS, 1) + ->addMetric(str_replace('{functionInternalId}', $function->getInternalId(), METRIC_FUNCTION_ID_EXECUTIONS), 1) + ->addMetric(METRIC_EXECUTIONS_COMPUTE, (int)($execution->getAttribute('duration') * 1000)) ->addMetric(str_replace('{functionInternalId}', $function->getInternalId(), METRIC_FUNCTION_ID_EXECUTIONS_COMPUTE), (int)($execution->getAttribute('duration') * 1000)) ->trigger() ; diff --git a/composer.lock b/composer.lock index d22f725bb4..05f90465c4 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "3e554f27be84931c1db939809a45feff", + "content-hash": "8c487168571ef67391005a55d93ad801", "packages": [ { "name": "adhocore/jwt", @@ -2269,16 +2269,16 @@ }, { "name": "utopia-php/storage", - "version": "0.14.0", + "version": "0.17.0", "source": { "type": "git", "url": "https://github.com/utopia-php/storage.git", - "reference": "eda6651ac16884dc2a79ecb984ea591ba1ed498c" + "reference": "efec5376c02d3d8330f1beb1469e6d6e313e21ee" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/storage/zipball/eda6651ac16884dc2a79ecb984ea591ba1ed498c", - "reference": "eda6651ac16884dc2a79ecb984ea591ba1ed498c", + "url": "https://api.github.com/repos/utopia-php/storage/zipball/efec5376c02d3d8330f1beb1469e6d6e313e21ee", + "reference": "efec5376c02d3d8330f1beb1469e6d6e313e21ee", "shasum": "" }, "require": { @@ -2286,10 +2286,12 @@ "ext-fileinfo": "*", "ext-lz4": "*", "ext-snappy": "*", + "ext-xz": "*", "ext-zlib": "*", "ext-zstd": "*", "php": ">=8.0", - "utopia-php/framework": "0.*.*" + "utopia-php/framework": "0.*.*", + "utopia-php/system": "0.*.*" }, "require-dev": { "laravel/pint": "1.2.*", @@ -2316,9 +2318,9 @@ ], "support": { "issues": "https://github.com/utopia-php/storage/issues", - "source": "https://github.com/utopia-php/storage/tree/0.14.0" + "source": "https://github.com/utopia-php/storage/tree/0.17.0" }, - "time": "2023-03-15T00:16:34+00:00" + "time": "2023-08-21T11:28:36+00:00" }, { "name": "utopia-php/swoole", diff --git a/src/Executor/Executor.php b/src/Executor/Executor.php index adc3b48b69..d81a4048c2 100644 --- a/src/Executor/Executor.php +++ b/src/Executor/Executor.php @@ -113,7 +113,7 @@ class Executor ) { $timeout = (int) App::getEnv('_APP_FUNCTIONS_BUILD_TIMEOUT', 900); - $runtimeId = "$projectId-$deploymentId-build"; + $runtimeId = "$projectId-$deploymentId"; $route = "/runtimes/{$runtimeId}/logs"; $params = [ 'timeout' => $timeout