compute stats
This commit is contained in:
parent
01016b0444
commit
25aca3c4d3
1 changed files with 18 additions and 1 deletions
|
@ -220,6 +220,23 @@ class UsageDB extends Usage
|
|||
$this->createOrUpdateMetric($projectId, 'storage.total', $projectFilesTotal + $deploymentsTotal);
|
||||
}
|
||||
|
||||
/**
|
||||
* Storage Stats
|
||||
* Metrics: storage.total, storage.files.total, storage.buckets.{bucketId}.files.total,
|
||||
* storage.buckets.count, storage.files.count, storage.buckets.{bucketId}.files.count
|
||||
*
|
||||
* @param string $projectId
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function computeStats(string $projectId): void
|
||||
{
|
||||
$executionTotal = $this->sum($projectId, 'executions', 'time', 'functions.executionTime.total');
|
||||
$buildTotal = $this->sum($projectId, 'builds', 'duration', 'functions.buildTime.total');
|
||||
|
||||
$this->createOrUpdateMetric($projectId, 'functions.compute.total', $executionTotal + $buildTotal);
|
||||
}
|
||||
|
||||
/**
|
||||
* Database Stats
|
||||
* Collect all database stats
|
||||
|
@ -268,7 +285,7 @@ class UsageDB extends Usage
|
|||
{
|
||||
$this->foreachDocument('console', 'projects', [], function (Document $project) {
|
||||
$projectId = $project->getInternalId();
|
||||
|
||||
$this->computeStats($projectId);
|
||||
$this->usersStats($projectId);
|
||||
$this->databaseStats($projectId);
|
||||
$this->storageStats($projectId);
|
||||
|
|
Loading…
Reference in a new issue