diff --git a/.env b/.env index 2e4b5fa5c7..06a6fa9b3e 100644 --- a/.env +++ b/.env @@ -85,7 +85,7 @@ _APP_MAINTENANCE_RETENTION_CACHE=2592000 _APP_MAINTENANCE_RETENTION_EXECUTION=1209600 _APP_MAINTENANCE_RETENTION_ABUSE=86400 _APP_MAINTENANCE_RETENTION_AUDIT=1209600 -_APP_STATS_AGGREGATION_INTERVAL=30 +_APP_USAGE_AGGREGATION_INTERVAL=30 _APP_STATS_RESOURCES_INTERVAL=3600 _APP_MAINTENANCE_RETENTION_USAGE_HOURLY=8640000 _APP_MAINTENANCE_RETENTION_SCHEDULES=86400 diff --git a/CHANGES.md b/CHANGES.md index 0e1be1698b..62db3d525e 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1687,7 +1687,7 @@ - Added new environment variables to enable error logging: - The `_APP_LOGGING_PROVIDER` variable allows you to enable the logger set the value to one of `sentry`, `raygun`, `appsignal`. - The `_APP_LOGGING_CONFIG` variable configures authentication to 3rd party error logging providers. If using Sentry, this should be 'SENTRY_API_KEY;SENTRY_APP_ID'. If using Raygun, this should be Raygun API key. If using AppSignal, this should be AppSignal API key. -- Added new environment variable `_APP_STATS_AGGREGATION_INTERVAL` to configure the usage worker interval +- Added new environment variable `_APP_USAGE_AGGREGATION_INTERVAL` to configure the usage worker interval - Added negative rotation values to file preview endpoint - Multiple responses from the Health service were changed to new (better) schema **Breaking Change** - Method `health.getAntiVirus()` has been renamed to `health.getAntivirus()` diff --git a/app/config/variables.php b/app/config/variables.php index 6603f246bc..57810525c7 100644 --- a/app/config/variables.php +++ b/app/config/variables.php @@ -224,7 +224,7 @@ return [ 'filter' => '' ], [ - 'name' => '_APP_STATS_AGGREGATION_INTERVAL', + 'name' => '_APP_USAGE_AGGREGATION_INTERVAL', 'description' => 'Interval value containing the number of seconds that the Appwrite usage process should wait before aggregating stats and syncing it to Database from TimeSeries data. The default value is 30 seconds. Reintroduced in 1.1.0.', 'introduction' => '1.1.0', 'default' => '30', @@ -234,7 +234,7 @@ return [ ], [ 'name' => '_APP_USAGE_TIMESERIES_INTERVAL', - 'description' => 'Deprecated since 1.1.0 use _APP_STATS_AGGREGATION_INTERVAL instead.', + 'description' => 'Deprecated since 1.1.0 use _APP_USAGE_AGGREGATION_INTERVAL instead.', 'introduction' => '1.0.0', 'default' => '30', 'required' => false, @@ -243,7 +243,7 @@ return [ ], [ 'name' => '_APP_USAGE_DATABASE_INTERVAL', - 'description' => 'Deprecated since 1.1.0 use _APP_STATS_AGGREGATION_INTERVAL instead.', + 'description' => 'Deprecated since 1.1.0 use _APP_USAGE_AGGREGATION_INTERVAL instead.', 'introduction' => '1.0.0', 'default' => '900', 'required' => false, diff --git a/app/views/install/compose.phtml b/app/views/install/compose.phtml index 1a1f07b8a0..d8f3f649e0 100644 --- a/app/views/install/compose.phtml +++ b/app/views/install/compose.phtml @@ -734,7 +734,7 @@ $image = $this->getParam('image', ''); - _APP_REDIS_PASS - _APP_USAGE_STATS - _APP_LOGGING_CONFIG - - _APP_STATS_AGGREGATION_INTERVAL + - _APP_USAGE_AGGREGATION_INTERVAL appwrite-worker-stats-usage-dump: image: /: @@ -762,7 +762,7 @@ $image = $this->getParam('image', ''); - _APP_REDIS_PASS - _APP_USAGE_STATS - _APP_LOGGING_CONFIG - - _APP_STATS_AGGREGATION_INTERVAL + - _APP_USAGE_AGGREGATION_INTERVAL appwrite-task-scheduler-functions: image: /: diff --git a/docker-compose.yml b/docker-compose.yml index 2603e707e8..5391bbe397 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -781,7 +781,7 @@ services: - _APP_REDIS_PASS - _APP_USAGE_STATS - _APP_LOGGING_CONFIG - - _APP_STATS_AGGREGATION_INTERVAL + - _APP_USAGE_AGGREGATION_INTERVAL - _APP_DATABASE_SHARED_TABLES appwrite-worker-stats-usage: @@ -812,7 +812,7 @@ services: - _APP_REDIS_PASS - _APP_USAGE_STATS - _APP_LOGGING_CONFIG - - _APP_STATS_AGGREGATION_INTERVAL + - _APP_USAGE_AGGREGATION_INTERVAL - _APP_DATABASE_SHARED_TABLES appwrite-worker-stats-usage-dump: @@ -843,7 +843,7 @@ services: - _APP_REDIS_PASS - _APP_USAGE_STATS - _APP_LOGGING_CONFIG - - _APP_STATS_AGGREGATION_INTERVAL + - _APP_USAGE_AGGREGATION_INTERVAL - _APP_DATABASE_SHARED_TABLES - _APP_STATS_USAGE_DUAL_WRITING_DBS diff --git a/src/Appwrite/Platform/Workers/StatsUsage.php b/src/Appwrite/Platform/Workers/StatsUsage.php index f0f7d99b03..c4d8b0e8d2 100644 --- a/src/Appwrite/Platform/Workers/StatsUsage.php +++ b/src/Appwrite/Platform/Workers/StatsUsage.php @@ -56,7 +56,7 @@ class StatsUsage extends Action } //Todo Figure out way to preserve keys when the container is being recreated @shimonewman - $aggregationInterval = (int) System::getEnv('_APP_STATS_AGGREGATION_INTERVAL', '20'); + $aggregationInterval = (int) System::getEnv('_APP_USAGE_AGGREGATION_INTERVAL', '20'); $project = new Document($payload['project'] ?? []); $projectId = $project->getInternalId(); foreach ($payload['reduce'] ?? [] as $document) { diff --git a/src/Appwrite/Platform/Workers/Usage.php b/src/Appwrite/Platform/Workers/Usage.php index 1380d223df..3687eeab67 100644 --- a/src/Appwrite/Platform/Workers/Usage.php +++ b/src/Appwrite/Platform/Workers/Usage.php @@ -41,7 +41,7 @@ class Usage extends Action $this->action($message, $project, $getProjectDB, $queueForUsageDump); }); - $this->aggregationInterval = (int) System::getEnv('_APP_STATS_AGGREGATION_INTERVAL', '20'); + $this->aggregationInterval = (int) System::getEnv('_APP_USAGE_AGGREGATION_INTERVAL', '20'); $this->lastTriggeredTime = time(); } diff --git a/tests/e2e/Services/Functions/FunctionsCustomServerTest.php b/tests/e2e/Services/Functions/FunctionsCustomServerTest.php index 9807e47999..d8d1eb8eb5 100644 --- a/tests/e2e/Services/Functions/FunctionsCustomServerTest.php +++ b/tests/e2e/Services/Functions/FunctionsCustomServerTest.php @@ -1687,7 +1687,7 @@ class FunctionsCustomServerTest extends Scope }); // Await Aggregation - sleep(System::getEnv('_APP_STATS_AGGREGATION_INTERVAL', 30)); + sleep(System::getEnv('_APP_USAGE_AGGREGATION_INTERVAL', 30)); $this->assertEventually(function () use ($functionId) { $response = $this->getFunctionUsage($functionId, [