Merge branch '1.6.x' of https://github.com/appwrite/appwrite into feat-payload-response-type

This commit is contained in:
loks0n
2024-10-01 20:27:10 +01:00
9 changed files with 81 additions and 139 deletions
-3
View File
@@ -320,15 +320,12 @@ These are the current metrics we collect usage stats for:
| executions | Total number of executions per project |
| databases | Total number of databases per project |
| databases.storage | Total amount of storage used by all databases per project (in bytes) |
| databases.storage_disk | Total amount of storage used by all database per project on disk (in bytes) |
| collections | Total number of collections per project |
| {databaseInternalId}.collections | Total number of collections per database|
| {databaseInternalId}.storage | Sum of database storage (in bytes) |
| {databaseInternalId}.storage_disk | Sum of database storage on disk (in bytes) |
| documents | Total number of documents per project |
| {databaseInternalId}.{collectionInternalId}.documents | Total number of documents per collection |
| {databaseInternalId}.{collectionInternalId}.storage | Sum of database storage used by the collection (in bytes) |
| {databsaeInternalId}.{collectionInternalId}.storage_disk | Sum of database storage used by the collection on disk (in bytes) |
| buckets | Total number of buckets per project |
| files | Total number of files per project |
| {bucketInternalId}.files.storage | Sum of files.storage per bucket (in bytes) |
+10 -10
View File
@@ -21282,7 +21282,7 @@
"rate-limit": 0,
"rate-time": 3600,
"rate-key": "url:{url},ip:{ip}",
"scope": "projects.read",
"scope": "keys.read",
"platforms": [
"console"
],
@@ -21342,7 +21342,7 @@
"rate-limit": 0,
"rate-time": 3600,
"rate-key": "url:{url},ip:{ip}",
"scope": "projects.write",
"scope": "keys.write",
"platforms": [
"console"
],
@@ -21437,7 +21437,7 @@
"rate-limit": 0,
"rate-time": 3600,
"rate-key": "url:{url},ip:{ip}",
"scope": "projects.read",
"scope": "keys.read",
"platforms": [
"console"
],
@@ -21507,7 +21507,7 @@
"rate-limit": 0,
"rate-time": 3600,
"rate-key": "url:{url},ip:{ip}",
"scope": "projects.write",
"scope": "keys.write",
"platforms": [
"console"
],
@@ -21603,7 +21603,7 @@
"rate-limit": 0,
"rate-time": 3600,
"rate-key": "url:{url},ip:{ip}",
"scope": "projects.write",
"scope": "keys.write",
"platforms": [
"console"
],
@@ -21814,7 +21814,7 @@
"rate-limit": 0,
"rate-time": 3600,
"rate-key": "url:{url},ip:{ip}",
"scope": "projects.read",
"scope": "platforms.read",
"platforms": [
"console"
],
@@ -21874,7 +21874,7 @@
"rate-limit": 0,
"rate-time": 3600,
"rate-key": "url:{url},ip:{ip}",
"scope": "projects.write",
"scope": "platforms.write",
"platforms": [
"console"
],
@@ -21995,7 +21995,7 @@
"rate-limit": 0,
"rate-time": 3600,
"rate-key": "url:{url},ip:{ip}",
"scope": "projects.read",
"scope": "platforms.read",
"platforms": [
"console"
],
@@ -22065,7 +22065,7 @@
"rate-limit": 0,
"rate-time": 3600,
"rate-key": "url:{url},ip:{ip}",
"scope": "projects.write",
"scope": "platforms.write",
"platforms": [
"console"
],
@@ -22162,7 +22162,7 @@
"rate-limit": 0,
"rate-time": 3600,
"rate-key": "url:{url},ip:{ip}",
"scope": "projects.write",
"scope": "platforms.write",
"platforms": [
"console"
],
+10 -10
View File
@@ -21282,7 +21282,7 @@
"rate-limit": 0,
"rate-time": 3600,
"rate-key": "url:{url},ip:{ip}",
"scope": "projects.read",
"scope": "keys.read",
"platforms": [
"console"
],
@@ -21342,7 +21342,7 @@
"rate-limit": 0,
"rate-time": 3600,
"rate-key": "url:{url},ip:{ip}",
"scope": "projects.write",
"scope": "keys.write",
"platforms": [
"console"
],
@@ -21437,7 +21437,7 @@
"rate-limit": 0,
"rate-time": 3600,
"rate-key": "url:{url},ip:{ip}",
"scope": "projects.read",
"scope": "keys.read",
"platforms": [
"console"
],
@@ -21507,7 +21507,7 @@
"rate-limit": 0,
"rate-time": 3600,
"rate-key": "url:{url},ip:{ip}",
"scope": "projects.write",
"scope": "keys.write",
"platforms": [
"console"
],
@@ -21603,7 +21603,7 @@
"rate-limit": 0,
"rate-time": 3600,
"rate-key": "url:{url},ip:{ip}",
"scope": "projects.write",
"scope": "keys.write",
"platforms": [
"console"
],
@@ -21814,7 +21814,7 @@
"rate-limit": 0,
"rate-time": 3600,
"rate-key": "url:{url},ip:{ip}",
"scope": "projects.read",
"scope": "platforms.read",
"platforms": [
"console"
],
@@ -21874,7 +21874,7 @@
"rate-limit": 0,
"rate-time": 3600,
"rate-key": "url:{url},ip:{ip}",
"scope": "projects.write",
"scope": "platforms.write",
"platforms": [
"console"
],
@@ -21995,7 +21995,7 @@
"rate-limit": 0,
"rate-time": 3600,
"rate-key": "url:{url},ip:{ip}",
"scope": "projects.read",
"scope": "platforms.read",
"platforms": [
"console"
],
@@ -22065,7 +22065,7 @@
"rate-limit": 0,
"rate-time": 3600,
"rate-key": "url:{url},ip:{ip}",
"scope": "projects.write",
"scope": "platforms.write",
"platforms": [
"console"
],
@@ -22162,7 +22162,7 @@
"rate-limit": 0,
"rate-time": 3600,
"rate-key": "url:{url},ip:{ip}",
"scope": "projects.write",
"scope": "platforms.write",
"platforms": [
"console"
],
+10 -10
View File
@@ -21748,7 +21748,7 @@
"rate-limit": 0,
"rate-time": 3600,
"rate-key": "url:{url},ip:{ip}",
"scope": "projects.read",
"scope": "keys.read",
"platforms": [
"console"
],
@@ -21808,7 +21808,7 @@
"rate-limit": 0,
"rate-time": 3600,
"rate-key": "url:{url},ip:{ip}",
"scope": "projects.write",
"scope": "keys.write",
"platforms": [
"console"
],
@@ -21904,7 +21904,7 @@
"rate-limit": 0,
"rate-time": 3600,
"rate-key": "url:{url},ip:{ip}",
"scope": "projects.read",
"scope": "keys.read",
"platforms": [
"console"
],
@@ -21972,7 +21972,7 @@
"rate-limit": 0,
"rate-time": 3600,
"rate-key": "url:{url},ip:{ip}",
"scope": "projects.write",
"scope": "keys.write",
"platforms": [
"console"
],
@@ -22069,7 +22069,7 @@
"rate-limit": 0,
"rate-time": 3600,
"rate-key": "url:{url},ip:{ip}",
"scope": "projects.write",
"scope": "keys.write",
"platforms": [
"console"
],
@@ -22280,7 +22280,7 @@
"rate-limit": 0,
"rate-time": 3600,
"rate-key": "url:{url},ip:{ip}",
"scope": "projects.read",
"scope": "platforms.read",
"platforms": [
"console"
],
@@ -22340,7 +22340,7 @@
"rate-limit": 0,
"rate-time": 3600,
"rate-key": "url:{url},ip:{ip}",
"scope": "projects.write",
"scope": "platforms.write",
"platforms": [
"console"
],
@@ -22464,7 +22464,7 @@
"rate-limit": 0,
"rate-time": 3600,
"rate-key": "url:{url},ip:{ip}",
"scope": "projects.read",
"scope": "platforms.read",
"platforms": [
"console"
],
@@ -22532,7 +22532,7 @@
"rate-limit": 0,
"rate-time": 3600,
"rate-key": "url:{url},ip:{ip}",
"scope": "projects.write",
"scope": "platforms.write",
"platforms": [
"console"
],
@@ -22631,7 +22631,7 @@
"rate-limit": 0,
"rate-time": 3600,
"rate-key": "url:{url},ip:{ip}",
"scope": "projects.write",
"scope": "platforms.write",
"platforms": [
"console"
],
+10 -10
View File
@@ -21748,7 +21748,7 @@
"rate-limit": 0,
"rate-time": 3600,
"rate-key": "url:{url},ip:{ip}",
"scope": "projects.read",
"scope": "keys.read",
"platforms": [
"console"
],
@@ -21808,7 +21808,7 @@
"rate-limit": 0,
"rate-time": 3600,
"rate-key": "url:{url},ip:{ip}",
"scope": "projects.write",
"scope": "keys.write",
"platforms": [
"console"
],
@@ -21904,7 +21904,7 @@
"rate-limit": 0,
"rate-time": 3600,
"rate-key": "url:{url},ip:{ip}",
"scope": "projects.read",
"scope": "keys.read",
"platforms": [
"console"
],
@@ -21972,7 +21972,7 @@
"rate-limit": 0,
"rate-time": 3600,
"rate-key": "url:{url},ip:{ip}",
"scope": "projects.write",
"scope": "keys.write",
"platforms": [
"console"
],
@@ -22069,7 +22069,7 @@
"rate-limit": 0,
"rate-time": 3600,
"rate-key": "url:{url},ip:{ip}",
"scope": "projects.write",
"scope": "keys.write",
"platforms": [
"console"
],
@@ -22280,7 +22280,7 @@
"rate-limit": 0,
"rate-time": 3600,
"rate-key": "url:{url},ip:{ip}",
"scope": "projects.read",
"scope": "platforms.read",
"platforms": [
"console"
],
@@ -22340,7 +22340,7 @@
"rate-limit": 0,
"rate-time": 3600,
"rate-key": "url:{url},ip:{ip}",
"scope": "projects.write",
"scope": "platforms.write",
"platforms": [
"console"
],
@@ -22464,7 +22464,7 @@
"rate-limit": 0,
"rate-time": 3600,
"rate-key": "url:{url},ip:{ip}",
"scope": "projects.read",
"scope": "platforms.read",
"platforms": [
"console"
],
@@ -22532,7 +22532,7 @@
"rate-limit": 0,
"rate-time": 3600,
"rate-key": "url:{url},ip:{ip}",
"scope": "projects.write",
"scope": "platforms.write",
"platforms": [
"console"
],
@@ -22631,7 +22631,7 @@
"rate-limit": 0,
"rate-time": 3600,
"rate-key": "url:{url},ip:{ip}",
"scope": "projects.write",
"scope": "platforms.write",
"platforms": [
"console"
],
-3
View File
@@ -240,15 +240,12 @@ const METRIC_SESSIONS = 'sessions';
const METRIC_DATABASES = 'databases';
const METRIC_COLLECTIONS = 'collections';
const METRIC_DATABASES_STORAGE = 'databases.storage';
const METRIC_DATABASES_STORAGE_DISK = 'databases.storage_disk';
const METRIC_DATABASE_ID_COLLECTIONS = '{databaseInternalId}.collections';
const METRIC_DATABASE_ID_STORAGE = '{databaseInternalId}.databases.storage';
const METRIC_DATABASE_ID_STORAGE_DISK = '{databaseInternalId}.databases.storage_disk';
const METRIC_DOCUMENTS = 'documents';
const METRIC_DATABASE_ID_DOCUMENTS = '{databaseInternalId}.documents';
const METRIC_DATABASE_ID_COLLECTION_ID_DOCUMENTS = '{databaseInternalId}.{collectionInternalId}.documents';
const METRIC_DATABASE_ID_COLLECTION_ID_STORAGE = '{databaseInternalId}.{collectionInternalId}.databases.storage';
const METRIC_DATABASE_ID_COLLECTION_ID_STORAGE_DISK = '{databaseInternalId}.{collectionInternalId}.databases.storage_disk';
const METRIC_BUCKETS = 'buckets';
const METRIC_FILES = 'files';
const METRIC_FILES_STORAGE = 'files.storage';
+1 -7
View File
@@ -51,7 +51,7 @@
"utopia-php/cache": "0.10.*",
"utopia-php/cli": "0.15.*",
"utopia-php/config": "0.2.*",
"utopia-php/database": "0.53.5-rc1",
"utopia-php/database": "0.53.5",
"utopia-php/domains": "0.5.*",
"utopia-php/dsn": "0.2.1",
"utopia-php/framework": "0.33.*",
@@ -97,11 +97,5 @@
"platform": {
"php": "8.3"
}
},
"repositories": {
"utopia-php/database": {
"type": "vcs",
"url": "https://github.com/utopia-php/database"
}
}
}
Generated
+35 -68
View File
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "7066d9ca32e7a1a60614effdc4701970",
"content-hash": "1981099f3c47f5536298222ba9b0b994",
"packages": [
{
"name": "adhocore/jwt",
@@ -1723,7 +1723,7 @@
},
{
"name": "utopia-php/database",
"version": "0.53.5-rc1",
"version": "0.53.5",
"source": {
"type": "git",
"url": "https://github.com/utopia-php/database.git",
@@ -1759,38 +1759,7 @@
"Utopia\\Database\\": "src/Database"
}
},
"autoload-dev": {
"psr-4": {
"Tests\\E2E\\": "tests/e2e",
"Tests\\Unit\\": "tests/unit"
}
},
"scripts": {
"build": [
"Composer\\Config::disableProcessTimeout",
"docker compose build"
],
"start": [
"Composer\\Config::disableProcessTimeout",
"docker compose up -d"
],
"test": [
"Composer\\Config::disableProcessTimeout",
"docker compose exec tests vendor/bin/phpunit --configuration phpunit.xml"
],
"lint": [
"./vendor/bin/pint --test"
],
"format": [
"./vendor/bin/pint"
],
"check": [
"./vendor/bin/phpstan analyse --level 7 src tests --memory-limit 512M"
],
"coverage": [
"./vendor/bin/coverage-check ./tmp/clover.xml 90"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
@@ -1803,8 +1772,8 @@
"utopia"
],
"support": {
"source": "https://github.com/utopia-php/database/tree/0.53.5-rc1",
"issues": "https://github.com/utopia-php/database/issues"
"issues": "https://github.com/utopia-php/database/issues",
"source": "https://github.com/utopia-php/database/tree/0.53.5"
},
"time": "2024-09-24T08:43:10+00:00"
},
@@ -2205,16 +2174,16 @@
},
{
"name": "utopia-php/migration",
"version": "0.5.2",
"version": "0.5.3",
"source": {
"type": "git",
"url": "https://github.com/utopia-php/migration.git",
"reference": "f18d44d4459f78c292dac9edde856fd156fe497a"
"reference": "b30e7834da69e25084b0c8e9ba29e4a7b54c6eb6"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/utopia-php/migration/zipball/f18d44d4459f78c292dac9edde856fd156fe497a",
"reference": "f18d44d4459f78c292dac9edde856fd156fe497a",
"url": "https://api.github.com/repos/utopia-php/migration/zipball/b30e7834da69e25084b0c8e9ba29e4a7b54c6eb6",
"reference": "b30e7834da69e25084b0c8e9ba29e4a7b54c6eb6",
"shasum": ""
},
"require": {
@@ -2247,9 +2216,9 @@
],
"support": {
"issues": "https://github.com/utopia-php/migration/issues",
"source": "https://github.com/utopia-php/migration/tree/0.5.2"
"source": "https://github.com/utopia-php/migration/tree/0.5.3"
},
"time": "2024-07-22T09:27:07+00:00"
"time": "2024-09-10T10:45:18+00:00"
},
{
"name": "utopia-php/mongo",
@@ -3024,16 +2993,16 @@
"packages-dev": [
{
"name": "appwrite/sdk-generator",
"version": "0.39.21",
"version": "0.39.22",
"source": {
"type": "git",
"url": "https://github.com/appwrite/sdk-generator.git",
"reference": "9754b190d33aaad56fdb8defc94f90248184c5ac"
"reference": "bdbb1607527550e67283ff0533522d1410c2c0df"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/appwrite/sdk-generator/zipball/9754b190d33aaad56fdb8defc94f90248184c5ac",
"reference": "9754b190d33aaad56fdb8defc94f90248184c5ac",
"url": "https://api.github.com/repos/appwrite/sdk-generator/zipball/bdbb1607527550e67283ff0533522d1410c2c0df",
"reference": "bdbb1607527550e67283ff0533522d1410c2c0df",
"shasum": ""
},
"require": {
@@ -3069,9 +3038,9 @@
"description": "Appwrite PHP library for generating API SDKs for multiple programming languages and platforms",
"support": {
"issues": "https://github.com/appwrite/sdk-generator/issues",
"source": "https://github.com/appwrite/sdk-generator/tree/0.39.21"
"source": "https://github.com/appwrite/sdk-generator/tree/0.39.22"
},
"time": "2024-09-10T08:49:29+00:00"
"time": "2024-10-01T16:16:26+00:00"
},
{
"name": "doctrine/annotations",
@@ -3345,16 +3314,16 @@
},
{
"name": "laravel/pint",
"version": "v1.17.3",
"version": "v1.18.1",
"source": {
"type": "git",
"url": "https://github.com/laravel/pint.git",
"reference": "9d77be916e145864f10788bb94531d03e1f7b482"
"reference": "35c00c05ec43e6b46d295efc0f4386ceb30d50d9"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/laravel/pint/zipball/9d77be916e145864f10788bb94531d03e1f7b482",
"reference": "9d77be916e145864f10788bb94531d03e1f7b482",
"url": "https://api.github.com/repos/laravel/pint/zipball/35c00c05ec43e6b46d295efc0f4386ceb30d50d9",
"reference": "35c00c05ec43e6b46d295efc0f4386ceb30d50d9",
"shasum": ""
},
"require": {
@@ -3407,7 +3376,7 @@
"issues": "https://github.com/laravel/pint/issues",
"source": "https://github.com/laravel/pint"
},
"time": "2024-09-03T15:00:28+00:00"
"time": "2024-09-24T17:22:50+00:00"
},
{
"name": "matthiasmullie/minify",
@@ -3595,16 +3564,16 @@
},
{
"name": "nikic/php-parser",
"version": "v5.2.0",
"version": "v5.3.0",
"source": {
"type": "git",
"url": "https://github.com/nikic/PHP-Parser.git",
"reference": "23c79fbbfb725fb92af9bcf41065c8e9a0d49ddb"
"reference": "3abf7425cd284141dc5d8d14a9ee444de3345d1a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/23c79fbbfb725fb92af9bcf41065c8e9a0d49ddb",
"reference": "23c79fbbfb725fb92af9bcf41065c8e9a0d49ddb",
"url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/3abf7425cd284141dc5d8d14a9ee444de3345d1a",
"reference": "3abf7425cd284141dc5d8d14a9ee444de3345d1a",
"shasum": ""
},
"require": {
@@ -3647,9 +3616,9 @@
],
"support": {
"issues": "https://github.com/nikic/PHP-Parser/issues",
"source": "https://github.com/nikic/PHP-Parser/tree/v5.2.0"
"source": "https://github.com/nikic/PHP-Parser/tree/v5.3.0"
},
"time": "2024-09-15T16:40:33+00:00"
"time": "2024-09-29T13:56:26+00:00"
},
{
"name": "phar-io/manifest",
@@ -4216,16 +4185,16 @@
},
{
"name": "phpstan/phpdoc-parser",
"version": "1.31.0",
"version": "1.32.0",
"source": {
"type": "git",
"url": "https://github.com/phpstan/phpdoc-parser.git",
"reference": "249f15fb843bf240cf058372dad29e100cee6c17"
"reference": "6ca22b154efdd9e3c68c56f5d94670920a1c19a4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/249f15fb843bf240cf058372dad29e100cee6c17",
"reference": "249f15fb843bf240cf058372dad29e100cee6c17",
"url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/6ca22b154efdd9e3c68c56f5d94670920a1c19a4",
"reference": "6ca22b154efdd9e3c68c56f5d94670920a1c19a4",
"shasum": ""
},
"require": {
@@ -4257,9 +4226,9 @@
"description": "PHPDoc parser with support for nullable, intersection and generic types",
"support": {
"issues": "https://github.com/phpstan/phpdoc-parser/issues",
"source": "https://github.com/phpstan/phpdoc-parser/tree/1.31.0"
"source": "https://github.com/phpstan/phpdoc-parser/tree/1.32.0"
},
"time": "2024-09-22T11:32:18+00:00"
"time": "2024-09-26T07:23:32+00:00"
},
{
"name": "phpunit/php-code-coverage",
@@ -7026,9 +6995,7 @@
],
"aliases": [],
"minimum-stability": "stable",
"stability-flags": {
"utopia-php/database": 5
},
"stability-flags": [],
"prefer-stable": false,
"prefer-lowest": false,
"platform": {
+5 -18
View File
@@ -163,7 +163,6 @@ class UsageDump extends Action
$id = \md5("{$time}_{$period}_{$key}");
$value = 0;
$diskValue = 0;
$previousValue = 0;
try {
$previousValue = ($dbForProject->getDocument('stats', $id))->getAttribute('value', 0);
@@ -179,8 +178,7 @@ class UsageDump extends Action
$collectionInternalId = $data[1];
try {
$value = $dbForProject->getSizeOfCollection('database_'.$databaseInternalId.'_collection_'.$collectionInternalId);
$diskValue = $dbForProject->getSizeOfCollectionOnDisk('database_'.$databaseInternalId.'_collection_'.$collectionInternalId);
$value = $dbForProject->getSizeOfCollection('database_' . $databaseInternalId . '_collection_' . $collectionInternalId);
} catch (\Exception $e) {
// Collection not found
if ($e->getMessage() !== 'Collection not found') {
@@ -190,25 +188,21 @@ class UsageDump extends Action
// Compare with previous value
$diff = $value - $previousValue;
$diskDiff = $diskValue - $previousValue;
if ($diff === 0 && $diskDiff === 0) {
if ($diff === 0) {
break;
}
// Update Collection
$updateMetric($dbForProject, $diff, $key, $period, $time);
$updateMetric($dbForProject, $diskDiff, $key . '_disk', $period, $time);
// Update Database
$databaseKey = str_replace(['{databaseInternalId}'], [$data[0]], METRIC_DATABASE_ID_STORAGE);
$updateMetric($dbForProject, $diff, $databaseKey, $period, $time);
$updateMetric($dbForProject, $diskDiff, $databaseKey . '_disk', $period, $time);
// Update Project
$projectKey = METRIC_DATABASES_STORAGE;
$updateMetric($dbForProject, $diff, $projectKey, $period, $time);
$updateMetric($dbForProject, $diskDiff, $projectKey . '_disk', $period, $time);
break;
// Database Level
case METRIC_DATABASE_LEVEL_STORAGE:
@@ -227,8 +221,7 @@ class UsageDump extends Action
foreach ($collections as $collection) {
try {
$value += $dbForProject->getSizeOfCollection('database_'.$databaseInternalId.'_collection_'.$collection->getInternalId());
$diskValue += $dbForProject->getSizeOfCollectionOnDisk('database_'.$databaseInternalId.'_collection_'.$collection->getInternalId());
$value += $dbForProject->getSizeOfCollection('database_' . $databaseInternalId . '_collection_' . $collection->getInternalId());
} catch (\Exception $e) {
// Collection not found
if ($e->getMessage() !== 'Collection not found') {
@@ -238,21 +231,18 @@ class UsageDump extends Action
}
$diff = $value - $previousValue;
$diskDiff = $diskValue - $previousValue;
if ($diff === 0 && $diskDiff === 0) {
if ($diff === 0) {
break;
}
// Update Database
$databaseKey = str_replace(['{databaseInternalId}'], [$data[0]], METRIC_DATABASE_ID_STORAGE);
$updateMetric($dbForProject, $diff, $databaseKey, $period, $time);
$updateMetric($dbForProject, $diskDiff, $databaseKey . '_disk', $period, $time);
// Update Project
$projectKey = METRIC_DATABASES_STORAGE;
$updateMetric($dbForProject, $diff, $projectKey, $period, $time);
$updateMetric($dbForProject, $diskDiff, $projectKey . '_disk', $period, $time);
break;
// Project Level
case METRIC_PROJECT_LEVEL_STORAGE:
@@ -266,8 +256,7 @@ class UsageDump extends Action
foreach ($collections as $collection) {
try {
$value += $dbForProject->getSizeOfCollection('database_'.$database->getInternalId().'_collection_'.$collection->getInternalId());
$diskValue += $dbForProject->getSizeOfCollectionOnDisk('database_'.$database->getInternalId().'_collection_'.$collection->getInternalId());
$value += $dbForProject->getSizeOfCollection('database_' . $database->getInternalId() . '_collection_' . $collection->getInternalId());
} catch (\Exception $e) {
// Collection not found
if ($e->getMessage() !== 'Collection not found') {
@@ -278,12 +267,10 @@ class UsageDump extends Action
}
$diff = $value - $previousValue;
$diskDiff = $diskValue - $previousValue;
// Update Project
$projectKey = METRIC_DATABASES_STORAGE;
$updateMetric($dbForProject, $diff, $projectKey, $period, $time);
$updateMetric($dbForProject, $diskDiff, $projectKey . '_disk', $period, $time);
break;
}
}