mirror of
https://github.com/appwrite/appwrite
synced 2026-05-24 09:28:40 +00:00
Merge pull request #9624 from appwrite/feat-cache-telemetry
feat: cache telemetry
This commit is contained in:
commit
2495101dfd
1 changed files with 12 additions and 5 deletions
|
|
@ -48,6 +48,8 @@ use Utopia\Storage\Device\S3;
|
||||||
use Utopia\Storage\Device\Wasabi;
|
use Utopia\Storage\Device\Wasabi;
|
||||||
use Utopia\Storage\Storage;
|
use Utopia\Storage\Storage;
|
||||||
use Utopia\System\System;
|
use Utopia\System\System;
|
||||||
|
use Utopia\Telemetry\Adapter as Telemetry;
|
||||||
|
use Utopia\Telemetry\Adapter\None as NoTelemetry;
|
||||||
use Utopia\Validator\Hostname;
|
use Utopia\Validator\Hostname;
|
||||||
use Utopia\VCS\Adapter\Git\GitHub as VcsGitHub;
|
use Utopia\VCS\Adapter\Git\GitHub as VcsGitHub;
|
||||||
|
|
||||||
|
|
@ -464,7 +466,9 @@ App::setResource('getLogsDB', function (Group $pools, Cache $cache) {
|
||||||
};
|
};
|
||||||
}, ['pools', 'cache']);
|
}, ['pools', 'cache']);
|
||||||
|
|
||||||
App::setResource('cache', function (Group $pools) {
|
App::setResource('telemetry', fn () => new NoTelemetry());
|
||||||
|
|
||||||
|
App::setResource('cache', function (Group $pools, Telemetry $telemetry) {
|
||||||
$list = Config::getParam('pools-cache', []);
|
$list = Config::getParam('pools-cache', []);
|
||||||
$adapters = [];
|
$adapters = [];
|
||||||
|
|
||||||
|
|
@ -472,12 +476,15 @@ App::setResource('cache', function (Group $pools) {
|
||||||
$adapters[] = $pools
|
$adapters[] = $pools
|
||||||
->get($value)
|
->get($value)
|
||||||
->pop()
|
->pop()
|
||||||
->getResource()
|
->getResource();
|
||||||
;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return new Cache(new Sharding($adapters));
|
$cache = new Cache(new Sharding($adapters));
|
||||||
}, ['pools']);
|
|
||||||
|
$cache->setTelemetry($telemetry);
|
||||||
|
|
||||||
|
return $cache;
|
||||||
|
}, ['pools', 'telemetry']);
|
||||||
|
|
||||||
App::setResource('redis', function () {
|
App::setResource('redis', function () {
|
||||||
$host = System::getEnv('_APP_REDIS_HOST', 'localhost');
|
$host = System::getEnv('_APP_REDIS_HOST', 'localhost');
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue