Remove logs queue health endpoint

This commit is contained in:
Chirag Aggarwal committed 2026-07-02 18:13:44 +05:30
1 parent 4189ab6809
commit 1a02e5e87f
5 files changed
-109

No files matched your search

@@ -1,60 +0,0 @@
<?php
namespace Appwrite\Platform\Modules\Health\Http\Health\Queue\Logs;
use Appwrite\Event\Publisher\Audit;
use Appwrite\Platform\Modules\Health\Http\Health\Queue\Base;
use Appwrite\SDK\AuthType;
use Appwrite\SDK\ContentType;
use Appwrite\SDK\Method;
use Appwrite\SDK\Response as SDKResponse;
use Appwrite\Utopia\Response;
use Utopia\Database\Document;
use Utopia\Validator\Integer;
class Get extends Base
{
public static function getName(): string
{
return 'getQueueLogs';
}
public function __construct()
{
$this
->setHttpMethod(Base::HTTP_REQUEST_METHOD_GET)
->setHttpPath('/v1/health/queue/logs')
->desc('Get logs queue')
->groups(['api', 'health'])
->label('scope', 'health.read')
->label('sdk', new Method(
namespace: 'health',
group: 'queue',
name: 'getQueueLogs',
description: '/docs/references/health/get-queue-logs.md',
auth: [AuthType::ADMIN, AuthType::KEY],
responses: [
new SDKResponse(
code: Response::STATUS_CODE_OK,
model: Response::MODEL_HEALTH_QUEUE,
)
],
contentType: ContentType::JSON
))
->param('threshold', 5000, new Integer(true), 'Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.', true)
->inject('publisherForAudits')
->inject('response')
->callback($this->action(...));
}
public function action(int|string $threshold, Audit $publisherForAudits, Response $response): void
{
$threshold = (int) $threshold;
$size = $publisherForAudits->getSize();
$this->assertQueueThreshold($size, $threshold);
$response->dynamic(new Document(['size' => $size]), Response::MODEL_HEALTH_QUEUE);
}
}
@@ -15,7 +15,6 @@ use Appwrite\Platform\Modules\Health\Http\Health\Queue\Databases\Get as GetQueue
use Appwrite\Platform\Modules\Health\Http\Health\Queue\Deletes\Get as GetQueueDeletes;
use Appwrite\Platform\Modules\Health\Http\Health\Queue\Failed\Get as GetFailedJobs;
use Appwrite\Platform\Modules\Health\Http\Health\Queue\Functions\Get as GetQueueFunctions;
use Appwrite\Platform\Modules\Health\Http\Health\Queue\Logs\Get as GetQueueLogs;
use Appwrite\Platform\Modules\Health\Http\Health\Queue\Mails\Get as GetQueueMails;
use Appwrite\Platform\Modules\Health\Http\Health\Queue\Messaging\Get as GetQueueMessaging;
use Appwrite\Platform\Modules\Health\Http\Health\Queue\Migrations\Get as GetQueueMigrations;
@@ -49,7 +48,6 @@ class Http extends Service
$this->addAction(GetQueueAudits::getName(), new GetQueueAudits());
$this->addAction(GetQueueWebhooks::getName(), new GetQueueWebhooks());
$this->addAction(GetQueueLogs::getName(), new GetQueueLogs());
$this->addAction(GetQueueCertificates::getName(), new GetQueueCertificates());
$this->addAction(GetQueueBuilds::getName(), new GetQueueBuilds());
$this->addAction(GetQueueDatabases::getName(), new GetQueueDatabases());
-7
View File
@@ -264,7 +264,6 @@ trait Base
public const string GET_CACHE_HEALTH = 'get_cache_health';
public const string GET_TIME_HEALTH = 'get_time_health';
public const string GET_WEBHOOKS_QUEUE_HEALTH = 'get_webhooks_queue_health';
public const string GET_LOGS_QUEUE_HEALTH = 'get_logs_queue_health';
public const string GET_CERTIFICATES_QUEUE_HEALTH = 'get_certificates_queue_health';
public const string GET_FUNCTION_QUEUE_HEALTH = 'get_functions_queue_health';
public const string GET_LOCAL_STORAGE_HEALTH = 'get_local_storage_health';
@@ -2451,12 +2450,6 @@ trait Base
size
}
}';
case self::GET_LOGS_QUEUE_HEALTH:
return 'query getLogsQueueHealth {
healthGetQueueLogs {
size
}
}';
case self::GET_CERTIFICATES_QUEUE_HEALTH:
return 'query getCertificatesQueueHealth {
healthGetQueueCertificates {
-21
View File
@@ -124,27 +124,6 @@ final class HealthTest extends Scope
return $webhooksQueueHealth;
}
public function testGetLogsQueueHealth(): array
{
$projectId = $this->getProject()['$id'];
$query = $this->getQuery(self::GET_LOGS_QUEUE_HEALTH);
$graphQLPayload = [
'query' => $query,
];
$logsQueueHealth = $this->client->call(Client::METHOD_POST, '/graphql', \array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => $projectId,
], $this->getHeaders()), $graphQLPayload);
$this->assertIsArray($logsQueueHealth['body']['data']);
$this->assertArrayNotHasKey('errors', $logsQueueHealth['body']);
$logsQueueHealth = $logsQueueHealth['body']['data']['healthGetQueueLogs'];
$this->assertIsArray($logsQueueHealth);
return $logsQueueHealth;
}
public function testGetCertificatesQueueHealth(): array
{
$projectId = $this->getProject()['$id'];
@@ -1,19 +0,0 @@
<?php
declare(strict_types=1);
namespace Tests\E2E\Services\Health;
final class LogsQueueTest extends HealthBase
{
public function testLogsQueue(): void
{
$response = $this->callGet('/health/queue/logs');
$this->assertEquals(200, $response['headers']['status-code']);
$this->assertIsInt($response['body']['size']);
$this->assertLessThan(100, $response['body']['size']);
$failure = $this->callGet('/health/queue/logs', ['threshold' => '0']);
$this->assertEquals(503, $failure['headers']['status-code']);
}
}