mirror of
https://github.com/appwrite/appwrite
synced 2026-05-24 09:28:40 +00:00
rename and remove unused param
This commit is contained in:
parent
d4f02402bd
commit
6b11fa26ce
2 changed files with 22 additions and 28 deletions
|
|
@ -139,13 +139,10 @@ App::init()
|
|||
|
||||
$usage
|
||||
->setParam('projectId', $project->getId())
|
||||
->setParam('httpRequest', 1)
|
||||
->setParam('httpUrl', $request->getHostname() . $request->getURI())
|
||||
->setParam('project.{scope}.network.requests', 1)
|
||||
->setParam('httpMethod', $request->getMethod())
|
||||
->setParam('httpPath', $route->getPath())
|
||||
->setParam('networkRequestSize', 0)
|
||||
->setParam('networkResponseSize', 0)
|
||||
->setParam('storage', 0);
|
||||
->setParam('project.{scope}.network.inbound', 0)
|
||||
->setParam('project.{scope}.network.outbound', 0);
|
||||
|
||||
$deletes->setProject($project);
|
||||
$database->setProject($project);
|
||||
|
|
@ -356,9 +353,15 @@ App::shutdown()
|
|||
}
|
||||
}
|
||||
|
||||
$fileSize = 0;
|
||||
$file = $request->getFiles('file');
|
||||
if(!empty($file)) {
|
||||
$fileSize = (\is_array($file['size']) && isset($file['size'][0])) ? $file['size'][0] : $file['size'];
|
||||
}
|
||||
|
||||
$usage
|
||||
->setParam('networkRequestSize', $request->getSize() + $usage->getParam('storage'))
|
||||
->setParam('networkResponseSize', $response->getSize())
|
||||
->submit();
|
||||
->setParam('project.{scope}.network.inbound', $request->getSize() + $fileSize)
|
||||
->setParam('project.{scope}.network.outbound', $response->getSize())
|
||||
->submit();
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -80,26 +80,22 @@ class Stats
|
|||
public function submit(): void
|
||||
{
|
||||
$projectId = $this->params['projectId'] ?? '';
|
||||
|
||||
$storage = $this->params['storage'] ?? 0;
|
||||
|
||||
$networkRequestSize = $this->params['networkRequestSize'] ?? 0;
|
||||
$networkResponseSize = $this->params['networkResponseSize'] ?? 0;
|
||||
|
||||
$httpMethod = $this->params['httpMethod'] ?? '';
|
||||
$httpRequest = $this->params['httpRequest'] ?? 0;
|
||||
|
||||
$tags = ",projectId={$projectId},version=" . App::getEnv('_APP_VERSION', 'UNKNOWN');
|
||||
|
||||
|
||||
// the global namespace is prepended to every key (optional)
|
||||
$this->statsd->setNamespace($this->namespace);
|
||||
|
||||
|
||||
$httpRequest = $this->params['project.{scope}.network.requests'] ?? 0;
|
||||
$httpMethod = $this->params['httpMethod'] ?? '';
|
||||
if ($httpRequest >= 1) {
|
||||
$this->statsd->increment('project.{scope}.network.requests' . $tags . ',method=' . \strtolower($httpMethod));
|
||||
}
|
||||
$this->statsd->count('project.{scope}.network.inbound' . $tags, $networkRequestSize);
|
||||
$this->statsd->count('project.{scope}.network.outbound' . $tags, $networkResponseSize);
|
||||
$this->statsd->count('project.{scope}.network.bandwidth' . $tags, $networkRequestSize + $networkResponseSize);
|
||||
|
||||
$inbound = $this->params['networkRequestSize'] ?? 0;
|
||||
$outbound = $this->params['networkResponseSize'] ?? 0;
|
||||
$this->statsd->count('project.{scope}.network.inbound' . $tags, $inbound);
|
||||
$this->statsd->count('project.{scope}.network.outbound' . $tags, $outbound);
|
||||
$this->statsd->count('project.{scope}.network.bandwidth' . $tags, $inbound + $outbound);
|
||||
|
||||
$usersMetrics = [
|
||||
'users.{scope}.requests.create',
|
||||
|
|
@ -171,11 +167,6 @@ class Stats
|
|||
}
|
||||
}
|
||||
|
||||
if ($storage >= 1) {
|
||||
$storageTags = $tags . ",bucketId=" . ($this->params['bucketId'] ?? '');
|
||||
$this->statsd->count('storage.all' . $storageTags, $storage);
|
||||
}
|
||||
|
||||
$functionId = $this->params['functionId'] ?? '';
|
||||
$functionExecution = $this->params['executions.{scope}.compute'] ?? 0;
|
||||
$functionExecutionTime = ($this->params['executionTime'] ?? 0) * 1000; // ms
|
||||
|
|
|
|||
Loading…
Reference in a new issue