From b16b662a21c3b4c11d19f8034c2e513bc4cbfe41 Mon Sep 17 00:00:00 2001 From: loks0n <22452787+loks0n@users.noreply.github.com> Date: Wed, 15 Jan 2025 14:53:38 +0000 Subject: [PATCH 1/6] debug: log usage --- src/Appwrite/Event/Usage.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Appwrite/Event/Usage.php b/src/Appwrite/Event/Usage.php index 89e900d2ab..a09b651da8 100644 --- a/src/Appwrite/Event/Usage.php +++ b/src/Appwrite/Event/Usage.php @@ -2,6 +2,7 @@ namespace Appwrite\Event; +use Utopia\CLI\Console; use Utopia\Database\Document; use Utopia\Queue\Client; use Utopia\Queue\Connection; @@ -62,6 +63,11 @@ class Usage extends Event return false; } + Console::log('------------------------'); + Console::log('Usage Event Triggered'); + Console::log('Metrics: ' . json_encode($this->metrics, JSON_PRETTY_PRINT)); + Console::log('------------------------'); + $client = new Client($this->queue, $this->connection); $result = $client->enqueue([ From f392b5ab45c8087c1a5065c8b37f33fffea8d7ee Mon Sep 17 00:00:00 2001 From: loks0n <22452787+loks0n@users.noreply.github.com> Date: Thu, 16 Jan 2025 16:01:35 +0000 Subject: [PATCH 2/6] chore: composer update --- composer.lock | 56 +++++++++++++++++++++++++-------------------------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/composer.lock b/composer.lock index b77915f0a4..57a5d9294a 100644 --- a/composer.lock +++ b/composer.lock @@ -1430,16 +1430,16 @@ }, { "name": "open-telemetry/gen-otlp-protobuf", - "version": "1.2.1", + "version": "1.5.0", "source": { "type": "git", "url": "https://github.com/opentelemetry-php/gen-otlp-protobuf.git", - "reference": "66c3b98e998a726691c92e6405a82e6e7b8b169d" + "reference": "585bafddd4ae6565de154610b10a787a455c9ba0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/opentelemetry-php/gen-otlp-protobuf/zipball/66c3b98e998a726691c92e6405a82e6e7b8b169d", - "reference": "66c3b98e998a726691c92e6405a82e6e7b8b169d", + "url": "https://api.github.com/repos/opentelemetry-php/gen-otlp-protobuf/zipball/585bafddd4ae6565de154610b10a787a455c9ba0", + "reference": "585bafddd4ae6565de154610b10a787a455c9ba0", "shasum": "" }, "require": { @@ -1489,7 +1489,7 @@ "issues": "https://github.com/open-telemetry/opentelemetry-php/issues", "source": "https://github.com/open-telemetry/opentelemetry-php" }, - "time": "2024-10-30T11:49:49+00:00" + "time": "2025-01-15T23:07:07+00:00" }, { "name": "open-telemetry/sdk", @@ -3379,16 +3379,16 @@ }, { "name": "utopia-php/compression", - "version": "0.1.2", + "version": "0.1.3", "source": { "type": "git", "url": "https://github.com/utopia-php/compression.git", - "reference": "6062f70596415f8d5de40a589367b0eb2a435f98" + "reference": "66f093557ba66d98245e562036182016c7dcfe8a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/compression/zipball/6062f70596415f8d5de40a589367b0eb2a435f98", - "reference": "6062f70596415f8d5de40a589367b0eb2a435f98", + "url": "https://api.github.com/repos/utopia-php/compression/zipball/66f093557ba66d98245e562036182016c7dcfe8a", + "reference": "66f093557ba66d98245e562036182016c7dcfe8a", "shasum": "" }, "require": { @@ -3419,9 +3419,9 @@ ], "support": { "issues": "https://github.com/utopia-php/compression/issues", - "source": "https://github.com/utopia-php/compression/tree/0.1.2" + "source": "https://github.com/utopia-php/compression/tree/0.1.3" }, - "time": "2024-11-08T14:59:54+00:00" + "time": "2025-01-15T15:15:51+00:00" }, { "name": "utopia-php/config", @@ -3678,16 +3678,16 @@ }, { "name": "utopia-php/framework", - "version": "0.33.15", + "version": "0.33.16", "source": { "type": "git", "url": "https://github.com/utopia-php/http.git", - "reference": "83b0628900c2c53e8c3efbf069f3e13050295edc" + "reference": "e91d4c560d1b809e25faa63d564fef034363b50f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/http/zipball/83b0628900c2c53e8c3efbf069f3e13050295edc", - "reference": "83b0628900c2c53e8c3efbf069f3e13050295edc", + "url": "https://api.github.com/repos/utopia-php/http/zipball/e91d4c560d1b809e25faa63d564fef034363b50f", + "reference": "e91d4c560d1b809e25faa63d564fef034363b50f", "shasum": "" }, "require": { @@ -3719,9 +3719,9 @@ ], "support": { "issues": "https://github.com/utopia-php/http/issues", - "source": "https://github.com/utopia-php/http/tree/0.33.15" + "source": "https://github.com/utopia-php/http/tree/0.33.16" }, - "time": "2024-12-10T13:07:04+00:00" + "time": "2025-01-16T15:58:50+00:00" }, { "name": "utopia-php/image", @@ -4095,16 +4095,16 @@ }, { "name": "utopia-php/platform", - "version": "0.7.1", + "version": "0.7.2", "source": { "type": "git", "url": "https://github.com/utopia-php/platform.git", - "reference": "3433a0f1a54988f2a59c735f507745cb2c24638a" + "reference": "6f9243848f1c6466f6509fd01c7e18306a6d8caf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/platform/zipball/3433a0f1a54988f2a59c735f507745cb2c24638a", - "reference": "3433a0f1a54988f2a59c735f507745cb2c24638a", + "url": "https://api.github.com/repos/utopia-php/platform/zipball/6f9243848f1c6466f6509fd01c7e18306a6d8caf", + "reference": "6f9243848f1c6466f6509fd01c7e18306a6d8caf", "shasum": "" }, "require": { @@ -4139,9 +4139,9 @@ ], "support": { "issues": "https://github.com/utopia-php/platform/issues", - "source": "https://github.com/utopia-php/platform/tree/0.7.1" + "source": "https://github.com/utopia-php/platform/tree/0.7.2" }, - "time": "2024-10-22T10:27:49+00:00" + "time": "2025-01-15T05:56:26+00:00" }, { "name": "utopia-php/pools", @@ -5126,16 +5126,16 @@ }, { "name": "laravel/pint", - "version": "v1.19.0", + "version": "v1.20.0", "source": { "type": "git", "url": "https://github.com/laravel/pint.git", - "reference": "8169513746e1bac70c85d6ea1524d9225d4886f0" + "reference": "53072e8ea22213a7ed168a8a15b96fbb8b82d44b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/pint/zipball/8169513746e1bac70c85d6ea1524d9225d4886f0", - "reference": "8169513746e1bac70c85d6ea1524d9225d4886f0", + "url": "https://api.github.com/repos/laravel/pint/zipball/53072e8ea22213a7ed168a8a15b96fbb8b82d44b", + "reference": "53072e8ea22213a7ed168a8a15b96fbb8b82d44b", "shasum": "" }, "require": { @@ -5188,7 +5188,7 @@ "issues": "https://github.com/laravel/pint/issues", "source": "https://github.com/laravel/pint" }, - "time": "2024-12-30T16:20:10+00:00" + "time": "2025-01-14T16:20:53+00:00" }, { "name": "matthiasmullie/minify", From 7db65f46ae0fe5b0646688b3e9af6487d94eed64 Mon Sep 17 00:00:00 2001 From: loks0n <22452787+loks0n@users.noreply.github.com> Date: Thu, 16 Jan 2025 17:23:22 +0000 Subject: [PATCH 3/6] feat: add compression toggle env --- app/http.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/http.php b/app/http.php index 3a7562ffd1..dac941d25b 100644 --- a/app/http.php +++ b/app/http.php @@ -334,7 +334,7 @@ $http->on(Constant::EVENT_REQUEST, function (SwooleRequest $swooleRequest, Swool } $app = new App('UTC'); - $app->setCompression(true); + $app->setCompression(System::getEnv('_APP_COMPRESSION_ENABLED', 'enabled') === 'enabled'); $app->setCompressionMinSize(intval(System::getEnv('_APP_COMPRESSION_MIN_SIZE_BYTES', '1024'))); // 1KB $pools = $register->get('pools'); From facdf1a362ed6a08afdfa0b7f6c45270c1b14965 Mon Sep 17 00:00:00 2001 From: loks0n <22452787+loks0n@users.noreply.github.com> Date: Thu, 16 Jan 2025 18:05:49 +0000 Subject: [PATCH 4/6] chore: revert usage debug --- src/Appwrite/Event/Usage.php | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/Appwrite/Event/Usage.php b/src/Appwrite/Event/Usage.php index a09b651da8..89e900d2ab 100644 --- a/src/Appwrite/Event/Usage.php +++ b/src/Appwrite/Event/Usage.php @@ -2,7 +2,6 @@ namespace Appwrite\Event; -use Utopia\CLI\Console; use Utopia\Database\Document; use Utopia\Queue\Client; use Utopia\Queue\Connection; @@ -63,11 +62,6 @@ class Usage extends Event return false; } - Console::log('------------------------'); - Console::log('Usage Event Triggered'); - Console::log('Metrics: ' . json_encode($this->metrics, JSON_PRETTY_PRINT)); - Console::log('------------------------'); - $client = new Client($this->queue, $this->connection); $result = $client->enqueue([ From e343a1068eca9322a1fc6df7c1b50a8d8b7807d8 Mon Sep 17 00:00:00 2001 From: loks0n <22452787+loks0n@users.noreply.github.com> Date: Fri, 17 Jan 2025 09:55:14 +0000 Subject: [PATCH 5/6] fix: linter --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index f89889f534..980dcdcd29 100644 --- a/composer.lock +++ b/composer.lock @@ -4095,16 +4095,16 @@ }, { "name": "utopia-php/platform", - "version": "0.7.2", + "version": "0.7.1", "source": { "type": "git", "url": "https://github.com/utopia-php/platform.git", - "reference": "6f9243848f1c6466f6509fd01c7e18306a6d8caf" + "reference": "3433a0f1a54988f2a59c735f507745cb2c24638a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/platform/zipball/6f9243848f1c6466f6509fd01c7e18306a6d8caf", - "reference": "6f9243848f1c6466f6509fd01c7e18306a6d8caf", + "url": "https://api.github.com/repos/utopia-php/platform/zipball/3433a0f1a54988f2a59c735f507745cb2c24638a", + "reference": "3433a0f1a54988f2a59c735f507745cb2c24638a", "shasum": "" }, "require": { @@ -4139,9 +4139,9 @@ ], "support": { "issues": "https://github.com/utopia-php/platform/issues", - "source": "https://github.com/utopia-php/platform/tree/0.7.2" + "source": "https://github.com/utopia-php/platform/tree/0.7.1" }, - "time": "2025-01-15T05:56:26+00:00" + "time": "2024-10-22T10:27:49+00:00" }, { "name": "utopia-php/pools", From 40f16fab500e0941be5ef21eb4a2a9abb4643a77 Mon Sep 17 00:00:00 2001 From: loks0n <22452787+loks0n@users.noreply.github.com> Date: Fri, 17 Jan 2025 10:17:49 +0000 Subject: [PATCH 6/6] docs: add compression vars to documentation --- app/config/variables.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/app/config/variables.php b/app/config/variables.php index 113fbae335..57810525c7 100644 --- a/app/config/variables.php +++ b/app/config/variables.php @@ -268,6 +268,24 @@ return [ 'question' => '', 'filter' => '' ], + [ + 'name' => '_APP_COMPRESSION_ENABLED', + 'description' => 'This option allows you to enable or disable the response compression for the Appwrite API. It\'s enabled by default with value "enabled", and to disable it, pass value "disabled".', + 'introduction' => '1.6.0', + 'default' => 'enabled', + 'required' => false, + 'question' => '', + 'filter' => '' + ], + [ + 'name' => '_APP_COMPRESSION_MIN_SIZE_BYTES', + 'description' => 'This option allows you to set the minimum size in bytes for the response compression to be applied. The default value is 1024 bytes.', + 'introduction' => '1.6.0', + 'default' => 1024, + 'required' => false, + 'question' => '', + 'filter' => '' + ] ], ], [