mirror of
https://github.com/appwrite/appwrite
synced 2026-04-21 13:37:16 +00:00
align it with cloud pattern
This commit is contained in:
parent
682a56c03c
commit
93b9500a95
1 changed files with 9 additions and 9 deletions
|
|
@ -21,6 +21,7 @@ use Utopia\Queue\Message;
|
|||
use Utopia\Storage\Device;
|
||||
use Utopia\System\System;
|
||||
use Utopia\Telemetry\Adapter as Telemetry;
|
||||
use Utopia\Telemetry\Counter;
|
||||
|
||||
use function Swoole\Coroutine\batch;
|
||||
|
||||
|
|
@ -67,6 +68,7 @@ class Screenshots extends Action
|
|||
}
|
||||
|
||||
$screenshotMessage = Screenshot::fromArray($payload);
|
||||
$counter = $telemetry->createCounter('worker.screenshots.capture');
|
||||
|
||||
Console::log('Site screenshot started');
|
||||
|
||||
|
|
@ -271,23 +273,21 @@ class Screenshots extends Action
|
|||
$date = \date('H:i:s');
|
||||
$this->appendToLogs($dbForProject, $deployment->getId(), $queueForRealtime, "[90m[$date] [90m[[0mappwrite[90m][33m Screenshot capturing failed. Deployment will continue. [0m\n");
|
||||
|
||||
$this->recordTelemetry($telemetry, 'failure');
|
||||
$this->recordTelemetry($counter, 'failure');
|
||||
|
||||
throw $th;
|
||||
}
|
||||
|
||||
$this->recordTelemetry($telemetry, 'success');
|
||||
$this->recordTelemetry($counter, 'success');
|
||||
}
|
||||
|
||||
protected function recordTelemetry(Telemetry $telemetry, string $result): void
|
||||
protected function recordTelemetry(Counter $counter, string $result): void
|
||||
{
|
||||
try {
|
||||
$telemetry
|
||||
->createCounter('worker.screenshots.capture')
|
||||
->add(1, [
|
||||
'resourceType' => RESOURCE_TYPE_SITES,
|
||||
'result' => $result,
|
||||
]);
|
||||
$counter->add(1, [
|
||||
'resourceType' => RESOURCE_TYPE_SITES,
|
||||
'result' => $result,
|
||||
]);
|
||||
} catch (\Throwable) {
|
||||
// Telemetry should never affect screenshot processing.
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue