Merge branch 'sentry' into develop

This commit is contained in:
ErickSkrauch 2016-12-09 11:08:48 +03:00
commit 8135d93d04
8 changed files with 54 additions and 1 deletions

View File

@ -9,6 +9,7 @@ JWT_USER_SECRET=
## Внешние сервисы
RECAPTCHA_PUBLIC=
RECAPTCHA_SECRET=
SENTRY_DSN=
## SMTP параметры
SMTP_USER=

View File

@ -21,6 +21,17 @@ return [
'log' => [
'traceLevel' => YII_DEBUG ? 3 : 0,
'targets' => [
[
'class' => mito\sentry\Target::class,
'levels' => ['error', 'warning'],
'except' => [
'legacy-authserver',
'session',
'yii\web\HttpException:*',
'api\modules\session\exceptions\SessionServerException:*',
'api\modules\authserver\exceptions\AuthserverException:*',
],
],
[
'class' => yii\log\FileTarget::class,
'levels' => ['error', 'warning'],

View File

@ -21,6 +21,7 @@ class Yii extends \yii\BaseYii {
* @property \common\components\RabbitMQ\Component $amqp
* @property \GuzzleHttp\Client $guzzle
* @property \common\components\EmailRenderer $emailRenderer
* @property \mito\sentry\Component $sentry
*/
abstract class BaseApplication extends yii\base\Application {
}

View File

@ -0,0 +1,18 @@
<?php
namespace common\components\Sentry;
use Yii;
class Component extends \mito\sentry\Component {
public $jsNotifier = false;
public function init() {
if (is_array($this->client) && !isset($this->client['release'])) {
$this->client['release'] = Yii::$app->version;
}
parent::init();
}
}

View File

@ -1,5 +1,6 @@
<?php
return [
'version' => '1.1.3-dev',
'vendorPath' => dirname(dirname(__DIR__)) . '/vendor',
'components' => [
'cache' => [
@ -34,6 +35,15 @@ return [
],
],
],
'sentry' => [
'class' => common\components\Sentry\Component::class,
'enabled' => !empty(getenv('SENTRY_DSN')),
'dsn' => getenv('SENTRY_DSN'),
'environment' => YII_ENV_DEV ? 'development' : 'production',
'client' => [
'curl_method' => 'async',
],
],
'security' => [
'passwordHashStrategy' => 'password_hash',
],

View File

@ -26,7 +26,8 @@
"emarref/jwt": "~1.0.3",
"ely/amqp-controller": "dev-master#d7f8cdbc66c45e477c9c7d5d509bc0c1b11fd3ec",
"ely/email-renderer": "dev-master#38a148cd5081147acc31125ddc49966b149f65cf",
"predis/predis": "^1.0"
"predis/predis": "^1.0",
"mito/yii2-sentry": "dev-fix_init#27f00805cb906f73b2c6f8181c1c655decb9be70"
},
"require-dev": {
"yiisoft/yii2-codeception": "*",
@ -57,6 +58,10 @@
{
"type": "git",
"url": "git@gitlab.ely.by:elyby/oauth2-server.git"
},
{
"type": "git",
"url": "git@github.com:erickskrauch/yii2-sentry.git"
}
],
"scripts": {

View File

@ -13,6 +13,10 @@ return [
'components' => [
'log' => [
'targets' => [
[
'class' => mito\sentry\Target::class,
'levels' => ['error', 'warning'],
],
[
'class' => yii\log\FileTarget::class,
'levels' => ['error', 'warning'],

View File

@ -20,5 +20,8 @@ return [
'amqp' => [
'class' => tests\codeception\common\_support\amqp\TestComponent::class,
],
'sentry' => [
'enabled' => false,
],
],
];