mirror of
https://github.com/appwrite/appwrite
synced 2026-05-23 08:58:35 +00:00
feat: telemetry for storage devices (#9761)
This commit is contained in:
parent
fdbc01aa3d
commit
651cec65da
3 changed files with 50 additions and 44 deletions
|
|
@ -507,21 +507,21 @@ App::setResource('timelimit', function (\Redis $redis) {
|
||||||
};
|
};
|
||||||
}, ['redis']);
|
}, ['redis']);
|
||||||
|
|
||||||
App::setResource('deviceForLocal', function () {
|
App::setResource('deviceForLocal', function (Telemetry $telemetry) {
|
||||||
return new Local();
|
return new Device\Telemetry($telemetry, new Local());
|
||||||
});
|
}, ['telemetry']);
|
||||||
|
|
||||||
App::setResource('deviceForFiles', function ($project) {
|
App::setResource('deviceForFiles', function ($project, Telemetry $telemetry) {
|
||||||
return getDevice(APP_STORAGE_UPLOADS . '/app-' . $project->getId());
|
return new Device\Telemetry($telemetry, getDevice(APP_STORAGE_UPLOADS . '/app-' . $project->getId()));
|
||||||
}, ['project']);
|
}, ['project', 'telemetry']);
|
||||||
|
|
||||||
App::setResource('deviceForFunctions', function ($project) {
|
App::setResource('deviceForFunctions', function ($project, Telemetry $telemetry) {
|
||||||
return getDevice(APP_STORAGE_FUNCTIONS . '/app-' . $project->getId());
|
return new Device\Telemetry($telemetry, getDevice(APP_STORAGE_FUNCTIONS . '/app-' . $project->getId()));
|
||||||
}, ['project']);
|
}, ['project', 'telemetry']);
|
||||||
|
|
||||||
App::setResource('deviceForBuilds', function ($project) {
|
App::setResource('deviceForBuilds', function ($project, Telemetry $telemetry) {
|
||||||
return getDevice(APP_STORAGE_BUILDS . '/app-' . $project->getId());
|
return new Device\Telemetry($telemetry, getDevice(APP_STORAGE_BUILDS . '/app-' . $project->getId()));
|
||||||
}, ['project']);
|
}, ['project', 'telemetry']);
|
||||||
|
|
||||||
function getDevice(string $root, string $connection = ''): Device
|
function getDevice(string $root, string $connection = ''): Device
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,10 @@ use Utopia\Queue\Message;
|
||||||
use Utopia\Queue\Publisher;
|
use Utopia\Queue\Publisher;
|
||||||
use Utopia\Queue\Server;
|
use Utopia\Queue\Server;
|
||||||
use Utopia\Registry\Registry;
|
use Utopia\Registry\Registry;
|
||||||
|
use Utopia\Storage\Device;
|
||||||
use Utopia\System\System;
|
use Utopia\System\System;
|
||||||
|
use Utopia\Telemetry\Adapter as Telemetry;
|
||||||
|
use Utopia\Telemetry\Adapter\None as NoTelemetry;
|
||||||
|
|
||||||
Authorization::disable();
|
Authorization::disable();
|
||||||
Runtime::enableCoroutine(SWOOLE_HOOK_ALL);
|
Runtime::enableCoroutine(SWOOLE_HOOK_ALL);
|
||||||
|
|
@ -334,21 +337,23 @@ Server::setResource('pools', function (Registry $register) {
|
||||||
return $register->get('pools');
|
return $register->get('pools');
|
||||||
}, ['register']);
|
}, ['register']);
|
||||||
|
|
||||||
Server::setResource('deviceForFunctions', function (Document $project) {
|
Server::setResource('telemetry', fn () => new NoTelemetry());
|
||||||
return getDevice(APP_STORAGE_FUNCTIONS . '/app-' . $project->getId());
|
|
||||||
}, ['project']);
|
|
||||||
|
|
||||||
Server::setResource('deviceForFiles', function (Document $project) {
|
Server::setResource('deviceForFunctions', function (Document $project, Telemetry $telemetry) {
|
||||||
return getDevice(APP_STORAGE_UPLOADS . '/app-' . $project->getId());
|
return new Device\Telemetry($telemetry, getDevice(APP_STORAGE_FUNCTIONS . '/app-' . $project->getId()));
|
||||||
}, ['project']);
|
}, ['project', 'telemetry']);
|
||||||
|
|
||||||
Server::setResource('deviceForBuilds', function (Document $project) {
|
Server::setResource('deviceForFiles', function (Document $project, Telemetry $telemetry) {
|
||||||
return getDevice(APP_STORAGE_BUILDS . '/app-' . $project->getId());
|
return new Device\Telemetry($telemetry, getDevice(APP_STORAGE_UPLOADS . '/app-' . $project->getId()));
|
||||||
}, ['project']);
|
}, ['project', 'telemetry']);
|
||||||
|
|
||||||
Server::setResource('deviceForCache', function (Document $project) {
|
Server::setResource('deviceForBuilds', function (Document $project, Telemetry $telemetry) {
|
||||||
return getDevice(APP_STORAGE_CACHE . '/app-' . $project->getId());
|
return new Device\Telemetry($telemetry, getDevice(APP_STORAGE_BUILDS . '/app-' . $project->getId()));
|
||||||
}, ['project']);
|
}, ['project', 'telemetry']);
|
||||||
|
|
||||||
|
Server::setResource('deviceForCache', function (Document $project, Telemetry $telemetry) {
|
||||||
|
return new Device\Telemetry($telemetry, getDevice(APP_STORAGE_CACHE . '/app-' . $project->getId()));
|
||||||
|
}, ['project', 'telemetry']);
|
||||||
|
|
||||||
Server::setResource(
|
Server::setResource(
|
||||||
'isResourceBlocked',
|
'isResourceBlocked',
|
||||||
|
|
|
||||||
41
composer.lock
generated
41
composer.lock
generated
|
|
@ -709,16 +709,16 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "google/protobuf",
|
"name": "google/protobuf",
|
||||||
"version": "v4.30.2",
|
"version": "v4.31.0",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/protocolbuffers/protobuf-php.git",
|
"url": "https://github.com/protocolbuffers/protobuf-php.git",
|
||||||
"reference": "a4c4d8565b40b9f76debc9dfeb221412eacb8ced"
|
"reference": "d59e31ce4bf0e4b48728e90c4d880839edb5be07"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/protocolbuffers/protobuf-php/zipball/a4c4d8565b40b9f76debc9dfeb221412eacb8ced",
|
"url": "https://api.github.com/repos/protocolbuffers/protobuf-php/zipball/d59e31ce4bf0e4b48728e90c4d880839edb5be07",
|
||||||
"reference": "a4c4d8565b40b9f76debc9dfeb221412eacb8ced",
|
"reference": "d59e31ce4bf0e4b48728e90c4d880839edb5be07",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
|
|
@ -747,9 +747,9 @@
|
||||||
"proto"
|
"proto"
|
||||||
],
|
],
|
||||||
"support": {
|
"support": {
|
||||||
"source": "https://github.com/protocolbuffers/protobuf-php/tree/v4.30.2"
|
"source": "https://github.com/protocolbuffers/protobuf-php/tree/v4.31.0"
|
||||||
},
|
},
|
||||||
"time": "2025-03-26T18:01:50+00:00"
|
"time": "2025-05-14T16:17:23+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "league/csv",
|
"name": "league/csv",
|
||||||
|
|
@ -3499,16 +3499,16 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "utopia-php/database",
|
"name": "utopia-php/database",
|
||||||
"version": "0.69.1",
|
"version": "0.69.2",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/utopia-php/database.git",
|
"url": "https://github.com/utopia-php/database.git",
|
||||||
"reference": "cc6538e05e25d930244ab938c966d32db0922e83"
|
"reference": "60591ab073bb80bb9843338754b679bb8169e4ed"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/utopia-php/database/zipball/cc6538e05e25d930244ab938c966d32db0922e83",
|
"url": "https://api.github.com/repos/utopia-php/database/zipball/60591ab073bb80bb9843338754b679bb8169e4ed",
|
||||||
"reference": "cc6538e05e25d930244ab938c966d32db0922e83",
|
"reference": "60591ab073bb80bb9843338754b679bb8169e4ed",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
|
|
@ -3549,9 +3549,9 @@
|
||||||
],
|
],
|
||||||
"support": {
|
"support": {
|
||||||
"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.69.1"
|
"source": "https://github.com/utopia-php/database/tree/0.69.2"
|
||||||
},
|
},
|
||||||
"time": "2025-05-13T12:00:31+00:00"
|
"time": "2025-05-14T07:51:44+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "utopia-php/domains",
|
"name": "utopia-php/domains",
|
||||||
|
|
@ -4331,16 +4331,16 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "utopia-php/storage",
|
"name": "utopia-php/storage",
|
||||||
"version": "0.18.10",
|
"version": "0.18.12",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/utopia-php/storage.git",
|
"url": "https://github.com/utopia-php/storage.git",
|
||||||
"reference": "76f31158f4251abb207f7a9b16f7cb0bfdb3b39e"
|
"reference": "9a2556c39b5f4d9f8e79111fd34ec889b7bb1e97"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/utopia-php/storage/zipball/76f31158f4251abb207f7a9b16f7cb0bfdb3b39e",
|
"url": "https://api.github.com/repos/utopia-php/storage/zipball/9a2556c39b5f4d9f8e79111fd34ec889b7bb1e97",
|
||||||
"reference": "76f31158f4251abb207f7a9b16f7cb0bfdb3b39e",
|
"reference": "9a2556c39b5f4d9f8e79111fd34ec889b7bb1e97",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
|
|
@ -4353,9 +4353,10 @@
|
||||||
"ext-xz": "*",
|
"ext-xz": "*",
|
||||||
"ext-zlib": "*",
|
"ext-zlib": "*",
|
||||||
"ext-zstd": "*",
|
"ext-zstd": "*",
|
||||||
"php": ">=8.0",
|
"php": ">=8.1",
|
||||||
"utopia-php/framework": "0.*.*",
|
"utopia-php/framework": "0.*.*",
|
||||||
"utopia-php/system": "0.*.*"
|
"utopia-php/system": "0.*.*",
|
||||||
|
"utopia-php/telemetry": "0.1.*"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"laravel/pint": "1.2.*",
|
"laravel/pint": "1.2.*",
|
||||||
|
|
@ -4382,9 +4383,9 @@
|
||||||
],
|
],
|
||||||
"support": {
|
"support": {
|
||||||
"issues": "https://github.com/utopia-php/storage/issues",
|
"issues": "https://github.com/utopia-php/storage/issues",
|
||||||
"source": "https://github.com/utopia-php/storage/tree/0.18.10"
|
"source": "https://github.com/utopia-php/storage/tree/0.18.12"
|
||||||
},
|
},
|
||||||
"time": "2025-03-03T10:47:54+00:00"
|
"time": "2025-05-15T07:55:58+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "utopia-php/swoole",
|
"name": "utopia-php/swoole",
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue