Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DOT-854 sentry #341

Merged
merged 3 commits into from
Jun 24, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -85,3 +85,6 @@ DRIP_ACCOUNT_ID=
DRIP_CAMPAIGN_ID=

CALENDAR_HASH=somehash

SENTRY_LARAVEL_DSN=https://50fd2fa440af4bb4a230f40ca8d8cf90@o879179.ingest.sentry.io/5831645
ngm marked this conversation as resolved.
Show resolved Hide resolved
SENTRY_TRACES_SAMPLE_RATE=1
9 changes: 9 additions & 0 deletions app/Exceptions/Handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,13 @@ public function render($request, Exception $exception)

return parent::render($request, $exception);
}

public function report(Exception $exception)
{
if (app()->bound('sentry') && app()->environment('production') && $this->shouldReport($exception)) {
app('sentry')->captureException($exception);
}

parent::report($exception);
}
}
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"egulias/email-validator": "2.1.25",
"fideloper/proxy": "^4.0",
"filp/whoops": "^2.9",
"fzaninotto/faker": "1.9.1",
"fzaninotto/faker": "1.9.2",
"guzzlehttp/guzzle": "^6.3",
"hieu-le/wordpress-xmlrpc-client": "~2.0",
"intervention/image": "^2.4",
Expand All @@ -31,6 +31,7 @@
"mcamara/laravel-localization": "^1.3",
"msurguy/honeypot": "^1.0",
"owen-it/laravel-auditing": "^8.0",
"sentry/sentry-laravel": "^2.7",
"soundasleep/html2text": "^1.1",
"spatie/calendar-links": "^1.2",
"spinen/laravel-discourse-sso": "^1.3",
Expand Down
57 changes: 57 additions & 0 deletions config/sentry.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<?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')),

// When left empty or `null` the Laravel environment will be used
'environment' => env('SENTRY_ENVIRONMENT'),

'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,
],

'tracing' => [
// Trace queue jobs as their own transactions
'queue_job_transactions' => env('SENTRY_TRACE_QUEUE_ENABLED', false),

// Capture queue jobs as spans when executed on the sync driver
'queue_jobs' => true,

// Capture SQL queries as spans
'sql_queries' => true,

// Try to find out where the SQL query originated from and add it to the query spans
'sql_origin' => true,

// Capture views as spans
'views' => true,

// Indicates if the tracing integrations supplied by Sentry should be loaded
'default_integrations' => true,
],

// @see: https://docs.sentry.io/platforms/php/configuration/options/#send-default-pii
'send_default_pii' => false,

'traces_sample_rate' => (float)(env('SENTRY_TRACES_SAMPLE_RATE', 0.0)),

'controllers_base_namespace' => env('SENTRY_CONTROLLERS_BASE_NAMESPACE', 'App\\Http\\Controllers'),

];
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
"webpack-shell-plugin": "^0.5.0"
},
"dependencies": {
"@sentry/tracing": "^6.7.2",
"@sentry/vue": "^6.7.2",
"ajv": "^6.5.4",
"bootstrap-fileinput": "^4.4.9",
"bootstrap-select": "^1.13.17",
Expand Down
20 changes: 20 additions & 0 deletions resources/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ import L from 'leaflet'
import 'leaflet/dist/leaflet.css'
import Multiselect from 'vue-multiselect'
import 'vue-multiselect/dist/vue-multiselect.min.css'
import * as Sentry from "@sentry/vue";
import { Integrations } from "@sentry/tracing";

// Without this, the default map marker doesn't appear in production. Fairly well-known problem.
// eslint-disable-next-line
Expand Down Expand Up @@ -1550,6 +1552,23 @@ jQuery(document).ready(function () {
lastScrollPosition = currentScrollPosition
})

// Sentry error
Sentry.init({
Vue,
dsn: "https://50fd2fa440af4bb4a230f40ca8d8cf90@o879179.ingest.sentry.io/5831645",
edwh marked this conversation as resolved.
Show resolved Hide resolved
integrations: [new Integrations.BrowserTracing()],

// We are low traffic, so we can capture all performance events.
tracesSampleRate: 1.0,

beforeSend(event) {
// Suppress development logs..
if (process.env.NODE_ENV === 'development') {
return null
}
}
});

// Vue.
//
// Create a mixin for translation.
Expand Down Expand Up @@ -1611,3 +1630,4 @@ jQuery(document).ready(function () {
})
$(".vue-placeholder-large").hide()
})