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_PUBLIC=
RECAPTCHA_SECRET= RECAPTCHA_SECRET=
SENTRY_DSN=
## SMTP параметры ## SMTP параметры
SMTP_USER= SMTP_USER=

View File

@ -21,6 +21,17 @@ return [
'log' => [ 'log' => [
'traceLevel' => YII_DEBUG ? 3 : 0, 'traceLevel' => YII_DEBUG ? 3 : 0,
'targets' => [ '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, 'class' => yii\log\FileTarget::class,
'levels' => ['error', 'warning'], 'levels' => ['error', 'warning'],

View File

@ -21,6 +21,7 @@ class Yii extends \yii\BaseYii {
* @property \common\components\RabbitMQ\Component $amqp * @property \common\components\RabbitMQ\Component $amqp
* @property \GuzzleHttp\Client $guzzle * @property \GuzzleHttp\Client $guzzle
* @property \common\components\EmailRenderer $emailRenderer * @property \common\components\EmailRenderer $emailRenderer
* @property \mito\sentry\Component $sentry
*/ */
abstract class BaseApplication extends yii\base\Application { 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 <?php
return [ return [
'version' => '1.1.3-dev',
'vendorPath' => dirname(dirname(__DIR__)) . '/vendor', 'vendorPath' => dirname(dirname(__DIR__)) . '/vendor',
'components' => [ 'components' => [
'cache' => [ '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' => [ 'security' => [
'passwordHashStrategy' => 'password_hash', 'passwordHashStrategy' => 'password_hash',
], ],

View File

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

View File

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

View File

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