1
0
Fork 0
mirror of synced 2024-10-03 02:37:40 +13:00

change execution usage trigger

This commit is contained in:
shimon 2023-12-12 21:55:01 +02:00
parent bdf9a64771
commit 41ae96ea77
2 changed files with 7 additions and 2 deletions

View file

@ -1725,8 +1725,8 @@ App::post('/v1/functions/:functionId/executions')
$queueForUsage $queueForUsage
->addMetric(METRIC_EXECUTIONS, 1) ->addMetric(METRIC_EXECUTIONS, 1)
->addMetric(str_replace('{functionInternalId}', $function->getInternalId(), METRIC_FUNCTION_ID_EXECUTIONS), 1) ->addMetric(str_replace('{functionInternalId}', $function->getInternalId(), METRIC_FUNCTION_ID_EXECUTIONS), 1)
->addMetric(METRIC_EXECUTIONS_COMPUTE, (int)($executionResponse['duration'] * 1000))// per project ->addMetric(METRIC_EXECUTIONS_COMPUTE, (int)($execution->getAttribute('duration') * 1000))// per project
->addMetric(str_replace('{functionInternalId}', $function->getInternalId(), METRIC_FUNCTION_ID_EXECUTIONS_COMPUTE), (int)($executionResponse['duration'] * 1000))// per function ->addMetric(str_replace('{functionInternalId}', $function->getInternalId(), METRIC_FUNCTION_ID_EXECUTIONS_COMPUTE), (int)($execution->getAttribute('duration') * 1000))// per function
; ;
} catch (\Throwable $th) { } catch (\Throwable $th) {
$durationEnd = \microtime(true); $durationEnd = \microtime(true);
@ -1741,6 +1741,9 @@ App::post('/v1/functions/:functionId/executions')
$queueForUsage $queueForUsage
->addMetric(METRIC_EXECUTIONS, 1) ->addMetric(METRIC_EXECUTIONS, 1)
->addMetric(str_replace('{functionInternalId}', $function->getInternalId(), METRIC_FUNCTION_ID_EXECUTIONS), 1) ->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
; ;
} }

View file

@ -437,6 +437,8 @@ class Functions extends Action
->setProject($project) ->setProject($project)
->addMetric(METRIC_EXECUTIONS, 1) ->addMetric(METRIC_EXECUTIONS, 1)
->addMetric(str_replace('{functionInternalId}', $function->getInternalId(), METRIC_FUNCTION_ID_EXECUTIONS), 1) ->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))
->trigger() ->trigger()
; ;
} }