collect function builds and total compute time
This commit is contained in:
parent
6a90c7c653
commit
01016b0444
|
@ -222,7 +222,7 @@ class BuildsV1 extends Worker
|
|||
$usage
|
||||
->setParam('projectId', $project->getId())
|
||||
->setParam('functionId', $function->getId())
|
||||
->setParam('functionExecution', 1)
|
||||
->setParam('functionBuild', 1)
|
||||
->setParam('functionBuildStatus', $build->getAttribute('status', ''))
|
||||
->setParam('functionBuildTime', $build->getAttribute('duration') * 1000) // ms
|
||||
->setParam('networkRequestSize', 0)
|
||||
|
|
|
@ -93,6 +93,10 @@ class Stats
|
|||
$functionExecution = $this->params['functionExecution'] ?? 0;
|
||||
$functionExecutionTime = $this->params['functionExecutionTime'] ?? 0;
|
||||
$functionStatus = $this->params['functionStatus'] ?? '';
|
||||
$functionBuildTime = $this->params['functionBuildTime'] ?? 0;
|
||||
$functionBuild = $this->params['functionBuild'] ?? 0;
|
||||
$functionBuildStatus = $this->params['functionBuildStatus'] ?? '';
|
||||
$functionCompute = $functionExecutionTime + $functionBuildTime;
|
||||
|
||||
$tags = ",projectId={$projectId},version=" . App::getEnv('_APP_VERSION', 'UNKNOWN');
|
||||
|
||||
|
@ -104,8 +108,15 @@ class Stats
|
|||
}
|
||||
|
||||
if ($functionExecution >= 1) {
|
||||
$this->statsd->increment('executions.all' . $tags . ',functionId=' . $functionId . ',functionStatus=' . $functionStatus);
|
||||
$this->statsd->count('executions.time' . $tags . ',functionId=' . $functionId, $functionExecutionTime);
|
||||
$this->statsd->increment('functions.executions.all' . $tags . ',functionId=' . $functionId . ',functionStatus=' . $functionStatus);
|
||||
$this->statsd->count('functions.executions.time' . $tags . ',functionId=' . $functionId, $functionExecutionTime);
|
||||
}
|
||||
if($functionBuild >= 1) {
|
||||
$this->statsd->increment('functions.builds.all' . $tags . ',functionId=' . $functionId . ',functionBuildStatus=' . $functionBuildStatus);
|
||||
$this->statsd->count('functions.builds.time' . $tags . ',functionId=' . $functionId, $functionExecutionTime);
|
||||
}
|
||||
if($functionBuild + $functionExecution >= 1) {
|
||||
$this->statsd->count('functions.compute.time' . $tags. ',functionId=' . $functionId, $functionCompute);
|
||||
}
|
||||
|
||||
$this->statsd->count('network.inbound' . $tags, $networkRequestSize);
|
||||
|
|
|
@ -172,20 +172,39 @@ class Usage
|
|||
'table' => 'appwrite_usage_users_sessions_delete',
|
||||
],
|
||||
'functions.functionId.executions' => [
|
||||
'table' => 'appwrite_usage_executions_all',
|
||||
'table' => 'appwrite_usage_functions_executions_all',
|
||||
'groupBy' => ['functionId'],
|
||||
],
|
||||
'functions.functionId.compute' => [
|
||||
'table' => 'appwrite_usage_executions_time',
|
||||
'functions.functionId.builds' => [
|
||||
'table' => 'appwrite_usage_functions_builds_all',
|
||||
'groupBy' => ['functionId'],
|
||||
],
|
||||
'functions.functionId.execution' => [
|
||||
'table' => 'appwrite_usage_functions_executions_time',
|
||||
'groupBy' => ['functionId'],
|
||||
],
|
||||
'functions.functionId.build' => [
|
||||
'table' => 'appwrite_usage_functions_builds_time',
|
||||
'groupBy' => ['functionId'],
|
||||
],
|
||||
'functions.functionId.compute' => [ // Built time + execution time
|
||||
'table' => 'appwrite_usage_functions_compute_time',
|
||||
'groupBy' => ['functionId'],
|
||||
],
|
||||
'functions.functionId.failures' => [
|
||||
'table' => 'appwrite_usage_executions_all',
|
||||
'table' => 'appwrite_usage_functions_executions_all',
|
||||
'groupBy' => ['functionId'],
|
||||
'filters' => [
|
||||
'functionStatus' => 'failed',
|
||||
],
|
||||
],
|
||||
'functions.functionId.builds' => [
|
||||
'table' => 'appwrite_usage_functions_builds_all',
|
||||
'groupBy' => ['functionId'],
|
||||
'filters' => [
|
||||
'functionBuildStatus' => 'failed',
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
protected array $periods = [
|
||||
|
|
Loading…
Reference in a new issue