From e84f72d32f2261de08875615b76f2175d5c1e3c7 Mon Sep 17 00:00:00 2001 From: briskt <3172830+briskt@users.noreply.github.com> Date: Wed, 11 Dec 2024 17:56:15 +0800 Subject: [PATCH 1/3] don't report user errors to Sentry --- application/common/config/main.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/application/common/config/main.php b/application/common/config/main.php index 39f5a10..b58b3a2 100644 --- a/application/common/config/main.php +++ b/application/common/config/main.php @@ -126,6 +126,15 @@ 'enabled' => !empty(Env::get('SENTRY_DSN')), 'dsn' => Env::get('SENTRY_DSN'), 'levels' => ['error'], + 'except' => [ + 'yii\web\HttpException:400', + 'yii\web\HttpException:401', + 'yii\web\HttpException:404', + 'yii\web\HttpException:409', + 'yii\web\HttpException:422', + 'yii\web\HttpException:502', + 'Sil\EmailService\Client\EmailServiceClientException', + ], 'context' => true, // Additional options for `Sentry\init` // https://docs.sentry.io/platforms/php/configuration/options From d1b713668673acc5ec109c1e2a973bc81024ad24 Mon Sep 17 00:00:00 2001 From: briskt <3172830+briskt@users.noreply.github.com> Date: Wed, 11 Dec 2024 17:57:21 +0800 Subject: [PATCH 2/3] replace notamedia/yii2-sentry with silinternational/yii2-sentry --- application/common/config/main.php | 2 +- application/composer.json | 4 +- application/composer.lock | 138 ++++++++++++++--------------- application/dependencies.json | 12 +-- 4 files changed, 78 insertions(+), 78 deletions(-) diff --git a/application/common/config/main.php b/application/common/config/main.php index b58b3a2..f0b4b93 100644 --- a/application/common/config/main.php +++ b/application/common/config/main.php @@ -1,6 +1,5 @@ =8.1", "psr/log": "^1|^2|^3", "symfony/deprecation-contracts": "^2.5|^3", - "symfony/http-client-contracts": "^3.4.1", + "symfony/http-client-contracts": "~3.4.3|^3.5.1", "symfony/service-contracts": "^2.5|^3" }, "conflict": { @@ -3987,7 +3987,7 @@ "http" ], "support": { - "source": "https://github.com/symfony/http-client/tree/v6.4.10" + "source": "https://github.com/symfony/http-client/tree/v6.4.16" }, "funding": [ { @@ -4003,20 +4003,20 @@ "type": "tidelift" } ], - "time": "2024-07-15T09:26:24+00:00" + "time": "2024-11-27T11:52:33+00:00" }, { "name": "symfony/http-client-contracts", - "version": "v3.5.0", + "version": "v3.5.1", "source": { "type": "git", "url": "https://github.com/symfony/http-client-contracts.git", - "reference": "20414d96f391677bf80078aa55baece78b82647d" + "reference": "c2f3ad828596624ca39ea40f83617ef51ca8bbf9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-client-contracts/zipball/20414d96f391677bf80078aa55baece78b82647d", - "reference": "20414d96f391677bf80078aa55baece78b82647d", + "url": "https://api.github.com/repos/symfony/http-client-contracts/zipball/c2f3ad828596624ca39ea40f83617ef51ca8bbf9", + "reference": "c2f3ad828596624ca39ea40f83617ef51ca8bbf9", "shasum": "" }, "require": { @@ -4024,12 +4024,12 @@ }, "type": "library", "extra": { + "thanks": { + "url": "https://github.com/symfony/contracts", + "name": "symfony/contracts" + }, "branch-alias": { "dev-main": "3.5-dev" - }, - "thanks": { - "name": "symfony/contracts", - "url": "https://github.com/symfony/contracts" } }, "autoload": { @@ -4065,7 +4065,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/http-client-contracts/tree/v3.5.0" + "source": "https://github.com/symfony/http-client-contracts/tree/v3.5.1" }, "funding": [ { @@ -4081,7 +4081,7 @@ "type": "tidelift" } ], - "time": "2024-04-18T09:32:20+00:00" + "time": "2024-11-25T12:02:18+00:00" }, { "name": "symfony/options-resolver", diff --git a/application/dependencies.json b/application/dependencies.json index 150f157..23360a0 100644 --- a/application/dependencies.json +++ b/application/dependencies.json @@ -87,10 +87,6 @@ "name": "monolog/monolog", "version": "2.9.3" }, - { - "name": "notamedia/yii2-sentry", - "version": "1.7.0" - }, { "name": "paragonie/constant_time_encoding", "version": "v3.0.0" @@ -195,6 +191,10 @@ "name": "silinternational/yii2-json-log-targets", "version": "2.1.0" }, + { + "name": "silinternational/yii2-sentry", + "version": "2.0.0" + }, { "name": "swiftmailer/swiftmailer", "version": "v6.3.0" @@ -205,11 +205,11 @@ }, { "name": "symfony/http-client", - "version": "v6.4.10" + "version": "v6.4.16" }, { "name": "symfony/http-client-contracts", - "version": "v3.5.0" + "version": "v3.5.1" }, { "name": "symfony/options-resolver", From f9983c7e201150355b6febbb2aaba41c680d8945 Mon Sep 17 00:00:00 2001 From: briskt <3172830+briskt@users.noreply.github.com> Date: Wed, 11 Dec 2024 17:57:45 +0800 Subject: [PATCH 3/3] add 'idp' tag to Sentry config --- application/common/config/main.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/application/common/config/main.php b/application/common/config/main.php index f0b4b93..cc821f2 100644 --- a/application/common/config/main.php +++ b/application/common/config/main.php @@ -136,6 +136,10 @@ 'Sil\EmailService\Client\EmailServiceClientException', ], 'context' => true, + 'tagCallback' => function ($tags) use ($idpName): array { + $tags['idp'] = $idpName; + return $tags; + }, // Additional options for `Sentry\init` // https://docs.sentry.io/platforms/php/configuration/options 'clientOptions' => [