-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Chore: Fix and improve error reporting
Because: - Browser errors were not being reported - Sentry has new performance profiling features we are This commit: - Load sentry browser from a CDN so it is loaded and available to report any errors before the rest of our JS - Adds a revision initializer so we can attach the specific release to Sentry errors. - Enable profile for the Sentry Ruby SDK.
- Loading branch information
1 parent
de0b832
commit 9f622e5
Showing
15 changed files
with
63 additions
and
134 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
import './src/sentry'; | ||
import './controllers'; | ||
import '@hotwired/turbo-rails'; | ||
import './src/custom_turbo_stream_actions'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* eslint-disable no-undef, no-unused-expressions */ | ||
|
||
const { | ||
SENTRY_DSN, currentUserSignedIn, currentUserId, currentUsername, revision, | ||
} = window; | ||
|
||
window.Sentry = window.Sentry || {}; | ||
window.Sentry && Sentry.onLoad && Sentry.onLoad(() => { | ||
Sentry.init({ | ||
dsn: SENTRY_DSN, | ||
environment: 'production', | ||
debug: true, | ||
release: revision, | ||
}); | ||
|
||
if (currentUserSignedIn) { | ||
Sentry.setUser({ | ||
id: currentUserId, | ||
name: currentUsername, | ||
}); | ||
} | ||
}); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<% if Rails.env.production? %> | ||
<script src="https://js.sentry-cdn.com/88c85c7e3b5b4548a663b61da9beea2a.min.js" crossorigin="anonymous"></script> | ||
|
||
<script type='text/javascript'> | ||
window.SENTRY_DSN = "<%= ENV['SENTRY_DSN'] %>" | ||
window.revision = "<%= Rails.configuration.revision %>"; | ||
window.currentUserSignedIn = "<%= user_signed_in? %>" | ||
|
||
<% if defined?(current_user) && current_user.present? %> | ||
window.currentUserId = "<%= current_user.id %>" | ||
window.currentUserName = "<%= current_user.username %>" | ||
<% end %> | ||
</script> | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Rails.configuration.revision = `git rev-parse HEAD`.strip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,18 @@ | ||
Sentry.init do |config| | ||
config.dsn = ENV['SENTRY_DSN'] | ||
config.breadcrumbs_logger = [:active_support_logger] | ||
|
||
config.enabled_environments = %w[production] | ||
config.breadcrumbs_logger = %i[active_support_logger http_logger] | ||
config.send_default_pii = true | ||
|
||
# enable tracing | ||
config.traces_sample_rate = 0.1 | ||
|
||
# enable profiling | ||
# this is relative to traces_sample_rate | ||
config.profiles_sample_rate = 1.0 | ||
|
||
filter = ActiveSupport::ParameterFilter.new(Rails.application.config.filter_parameters) | ||
config.before_send = lambda { |event, _| | ||
filter.filter(event.to_hash) | ||
} | ||
|
||
config.send_default_pii = true | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.