Add support for in browser sentry
This commit is contained in:
parent
65ca41ff8d
commit
541df2d961
8 changed files with 79 additions and 2 deletions
|
@ -67,4 +67,17 @@ module ApplicationHelper
|
||||||
Raven.capture_exception(e)
|
Raven.capture_exception(e)
|
||||||
{}
|
{}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def sentry_config
|
||||||
|
sentry = Rails.application.secrets.sentry
|
||||||
|
if sentry
|
||||||
|
{
|
||||||
|
dsn: sentry[:browser],
|
||||||
|
id: current_user&.id,
|
||||||
|
email: current_email
|
||||||
|
}.to_json
|
||||||
|
else
|
||||||
|
{}
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -13,6 +13,7 @@ import 'babel-polyfill';
|
||||||
|
|
||||||
import 'typeahead.js';
|
import 'typeahead.js';
|
||||||
|
|
||||||
|
import '../shared/sentry';
|
||||||
import '../shared/rails-ujs-fix';
|
import '../shared/rails-ujs-fix';
|
||||||
|
|
||||||
// Start Rails helpers
|
// Start Rails helpers
|
||||||
|
|
|
@ -13,6 +13,7 @@ import 'babel-polyfill';
|
||||||
import 'select2';
|
import 'select2';
|
||||||
import 'typeahead.js';
|
import 'typeahead.js';
|
||||||
|
|
||||||
|
import '../shared/sentry';
|
||||||
import '../shared/rails-ujs-fix';
|
import '../shared/rails-ujs-fix';
|
||||||
|
|
||||||
import '../new_design/buttons';
|
import '../new_design/buttons';
|
||||||
|
|
14
app/javascript/shared/sentry.js
Normal file
14
app/javascript/shared/sentry.js
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
import { init, configureScope } from '@sentry/browser';
|
||||||
|
import { getData } from './data';
|
||||||
|
|
||||||
|
const { dsn, email, id } = getData('sentry');
|
||||||
|
|
||||||
|
if (dsn) {
|
||||||
|
init({ dsn });
|
||||||
|
|
||||||
|
if (email) {
|
||||||
|
configureScope(scope => {
|
||||||
|
scope.setUser({ id, email });
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -17,7 +17,9 @@
|
||||||
= csrf_meta_tags
|
= csrf_meta_tags
|
||||||
|
|
||||||
:javascript
|
:javascript
|
||||||
DATA = [];
|
DATA = [{
|
||||||
|
sentry: #{raw(sentry_config)}
|
||||||
|
}];
|
||||||
%body
|
%body
|
||||||
= render partial: 'layouts/support_navigator_banner'
|
= render partial: 'layouts/support_navigator_banner'
|
||||||
= render partial: 'layouts/pre_maintenance'
|
= render partial: 'layouts/pre_maintenance'
|
||||||
|
|
|
@ -22,7 +22,9 @@
|
||||||
= stylesheet_link_tag :xray
|
= stylesheet_link_tag :xray
|
||||||
|
|
||||||
:javascript
|
:javascript
|
||||||
DATA = [];
|
DATA = [{
|
||||||
|
sentry: #{raw(sentry_config)}
|
||||||
|
}];
|
||||||
%body
|
%body
|
||||||
.page-wrapper
|
.page-wrapper
|
||||||
= render partial: "layouts/support_navigator_banner"
|
= render partial: "layouts/support_navigator_banner"
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
{
|
{
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@rails/webpacker": "4.0.0-pre.2",
|
"@rails/webpacker": "4.0.0-pre.2",
|
||||||
|
"@sentry/browser": "^4.0.0-beta.12",
|
||||||
"activestorage": "^5.2.0",
|
"activestorage": "^5.2.0",
|
||||||
"bloodhound-js": "^1.2.2",
|
"bloodhound-js": "^1.2.2",
|
||||||
"chartkick": "^2.3.6",
|
"chartkick": "^2.3.6",
|
||||||
|
|
43
yarn.lock
43
yarn.lock
|
@ -49,6 +49,49 @@
|
||||||
dependencies:
|
dependencies:
|
||||||
any-observable "^0.3.0"
|
any-observable "^0.3.0"
|
||||||
|
|
||||||
|
"@sentry/browser@^4.0.0-beta.12":
|
||||||
|
version "4.0.0-beta.12"
|
||||||
|
resolved "https://registry.yarnpkg.com/@sentry/browser/-/browser-4.0.0-beta.12.tgz#dff44c7a3732577057844b1643e0ba38c644138b"
|
||||||
|
dependencies:
|
||||||
|
"@sentry/core" "4.0.0-beta.12"
|
||||||
|
"@sentry/hub" "4.0.0-beta.12"
|
||||||
|
"@sentry/minimal" "4.0.0-beta.12"
|
||||||
|
"@sentry/types" "4.0.0-beta.12"
|
||||||
|
"@sentry/utils" "4.0.0-beta.12"
|
||||||
|
|
||||||
|
"@sentry/core@4.0.0-beta.12":
|
||||||
|
version "4.0.0-beta.12"
|
||||||
|
resolved "https://registry.yarnpkg.com/@sentry/core/-/core-4.0.0-beta.12.tgz#c821e41b02c1d66e48fbef16da744f0173575558"
|
||||||
|
dependencies:
|
||||||
|
"@sentry/hub" "4.0.0-beta.12"
|
||||||
|
"@sentry/minimal" "4.0.0-beta.12"
|
||||||
|
"@sentry/types" "4.0.0-beta.12"
|
||||||
|
"@sentry/utils" "4.0.0-beta.12"
|
||||||
|
|
||||||
|
"@sentry/hub@4.0.0-beta.12":
|
||||||
|
version "4.0.0-beta.12"
|
||||||
|
resolved "https://registry.yarnpkg.com/@sentry/hub/-/hub-4.0.0-beta.12.tgz#85267cec47c0bbf1094a537f7d14d19495c77234"
|
||||||
|
dependencies:
|
||||||
|
"@sentry/types" "4.0.0-beta.12"
|
||||||
|
"@sentry/utils" "4.0.0-beta.12"
|
||||||
|
|
||||||
|
"@sentry/minimal@4.0.0-beta.12":
|
||||||
|
version "4.0.0-beta.12"
|
||||||
|
resolved "https://registry.yarnpkg.com/@sentry/minimal/-/minimal-4.0.0-beta.12.tgz#534e8edd065646e0e5f8d71443a63f6ce7187573"
|
||||||
|
dependencies:
|
||||||
|
"@sentry/hub" "4.0.0-beta.12"
|
||||||
|
"@sentry/types" "4.0.0-beta.12"
|
||||||
|
|
||||||
|
"@sentry/types@4.0.0-beta.12":
|
||||||
|
version "4.0.0-beta.12"
|
||||||
|
resolved "https://registry.yarnpkg.com/@sentry/types/-/types-4.0.0-beta.12.tgz#0abd303692e48c0fc11afbfea8cbad87e625357a"
|
||||||
|
|
||||||
|
"@sentry/utils@4.0.0-beta.12":
|
||||||
|
version "4.0.0-beta.12"
|
||||||
|
resolved "https://registry.yarnpkg.com/@sentry/utils/-/utils-4.0.0-beta.12.tgz#9d51e88634843232b6c6f0edb6df3d3fba83071e"
|
||||||
|
dependencies:
|
||||||
|
"@sentry/types" "4.0.0-beta.12"
|
||||||
|
|
||||||
"@sindresorhus/is@^0.7.0":
|
"@sindresorhus/is@^0.7.0":
|
||||||
version "0.7.0"
|
version "0.7.0"
|
||||||
resolved "https://registry.yarnpkg.com/@sindresorhus/is/-/is-0.7.0.tgz#9a06f4f137ee84d7df0460c1fdb1135ffa6c50fd"
|
resolved "https://registry.yarnpkg.com/@sindresorhus/is/-/is-0.7.0.tgz#9a06f4f137ee84d7df0460c1fdb1135ffa6c50fd"
|
||||||
|
|
Loading…
Reference in a new issue