Сбор метрик о работе воркера

This commit is contained in:
ErickSkrauch 2017-11-22 22:45:21 +03:00
parent 6f7fcf9e44
commit 0fee23ac86

View File

@ -32,11 +32,14 @@ class AccountQueueController extends AmqpController {
} }
public function routeUsernameChanged(UsernameChanged $body): bool { public function routeUsernameChanged(UsernameChanged $body): bool {
Yii::$app->statsd->inc('worker.account.usernameChanged.attempt');
$mojangApi = $this->createMojangApi(); $mojangApi = $this->createMojangApi();
try { try {
$response = $mojangApi->usernameToUUID($body->newUsername); $response = $mojangApi->usernameToUUID($body->newUsername);
Yii::$app->statsd->inc('worker.account.usernameChanged.found');
} catch (NoContentException $e) { } catch (NoContentException $e) {
$response = false; $response = false;
Yii::$app->statsd->inc('worker.account.usernameChanged.not_found');
} catch (RequestException $e) { } catch (RequestException $e) {
return true; return true;
} }