new stats and lints

This commit is contained in:
Damodar Lohani 2022-06-29 07:40:15 +00:00
parent 71c8c8a72e
commit 79936b88d0
3 changed files with 8 additions and 8 deletions

View file

@ -111,12 +111,12 @@ class Stats
$this->statsd->increment('functions.executions.all' . $tags . ',functionId=' . $functionId . ',functionStatus=' . $functionStatus);
$this->statsd->count('functions.executions.time' . $tags . ',functionId=' . $functionId, $functionExecutionTime);
}
if($functionBuild >= 1) {
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);
if ($functionBuild + $functionExecution >= 1) {
$this->statsd->count('functions.compute.time' . $tags . ',functionId=' . $functionId, $functionCompute);
}
$this->statsd->count('network.inbound' . $tags, $networkRequestSize);

View file

@ -197,14 +197,14 @@ class Usage
'table' => 'appwrite_usage_functions_compute_time',
'groupBy' => ['functionId'],
],
'functions.functionId.failures' => [
'functions.functionId.executions.failures' => [
'table' => 'appwrite_usage_functions_executions_all',
'groupBy' => ['functionId'],
'filters' => [
'functionStatus' => 'failed',
],
],
'functions.functionId.builds' => [
'functions.functionId.builds.failures' => [
'table' => 'appwrite_usage_functions_builds_all',
'groupBy' => ['functionId'],
'filters' => [

View file

@ -231,10 +231,10 @@ class UsageDB extends Usage
*/
private function computeStats(string $projectId): void
{
$executionTotal = $this->sum($projectId, 'executions', 'time', 'functions.executionTime.total');
$buildTotal = $this->sum($projectId, 'builds', 'duration', 'functions.buildTime.total');
$executionTotal = $this->sum($projectId, 'executions', 'time', 'functions.executionTime');
$buildTotal = $this->sum($projectId, 'builds', 'duration', 'functions.buildTime');
$this->createOrUpdateMetric($projectId, 'functions.compute.total', $executionTotal + $buildTotal);
$this->createOrUpdateMetric($projectId, 'functions.compute', $executionTotal + $buildTotal);
}
/**