Add Sentry integration

This commit is contained in:
shibafu 2020-07-16 22:11:42 +09:00
parent 6c3bcd57c5
commit 19d4ba5e40
5 changed files with 1211 additions and 265 deletions

View File

@ -52,3 +52,5 @@ MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
# https://www.google.com/recaptcha # https://www.google.com/recaptcha
NOCAPTCHA_SECRET= NOCAPTCHA_SECRET=
NOCAPTCHA_SITEKEY= NOCAPTCHA_SITEKEY=
SENTRY_LARAVEL_DSN=

View File

@ -32,6 +32,10 @@ class Handler extends ExceptionHandler
*/ */
public function report(Exception $exception) public function report(Exception $exception)
{ {
if (app()->bound('sentry') && $this->shouldReport($exception)) {
app('sentry')->captureException($exception);
}
parent::report($exception); parent::report($exception);
} }

View File

@ -24,6 +24,7 @@
"league/csv": "^9.5", "league/csv": "^9.5",
"misd/linkify": "^1.1", "misd/linkify": "^1.1",
"openpear/stream_filter_mbstring": "dev-master", "openpear/stream_filter_mbstring": "dev-master",
"sentry/sentry-laravel": "1.8.0",
"staudenmeir/eloquent-eager-limit": "^1.0", "staudenmeir/eloquent-eager-limit": "^1.0",
"symfony/css-selector": "^4.3", "symfony/css-selector": "^4.3",
"symfony/dom-crawler": "^4.3" "symfony/dom-crawler": "^4.3"

1439
composer.lock generated

File diff suppressed because it is too large Load Diff

30
config/sentry.php Normal file
View File

@ -0,0 +1,30 @@
<?php
return [
'dsn' => env('SENTRY_LARAVEL_DSN', env('SENTRY_DSN')),
// capture release as git sha
// 'release' => trim(exec('git --git-dir ' . base_path('.git') . ' log --pretty="%h" -n1 HEAD')),
'breadcrumbs' => [
// Capture Laravel logs in breadcrumbs
'logs' => true,
// Capture SQL queries in breadcrumbs
'sql_queries' => true,
// Capture bindings on SQL queries logged in breadcrumbs
'sql_bindings' => true,
// Capture queue job information in breadcrumbs
'queue_info' => true,
// Capture command information in breadcrumbs
'command_info' => true,
],
// @see: https://docs.sentry.io/error-reporting/configuration/?platform=php#send-default-pii
'send_default_pii' => false,
];