Merge pull request #241 from Retrospring/feature/sentry

Integrate Sentry
This commit is contained in:
Karina Kwiatek 2021-12-28 19:55:02 +01:00 committed by GitHub
commit 4008d2fd05
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
20 changed files with 180 additions and 174 deletions

View File

@ -40,7 +40,9 @@ gem 'ruby-progressbar'
gem 'rails_admin'
gem 'pghero'
gem 'newrelic_rpm'
gem "sentry-ruby"
gem "sentry-rails"
gem "sentry-sidekiq"
gem 'sidekiq', "< 6" # remove version constraint once we have redis 5

View File

@ -52,7 +52,7 @@ GEM
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.3)
active_model_otp (2.1.1)
active_model_otp (2.3.1)
activemodel
rotp (~> 6.2.0)
activejob (5.2.6)
@ -81,8 +81,8 @@ GEM
public_suffix (>= 2.0.2, < 5.0)
arel (9.0.0)
ast (2.4.2)
autoprefixer-rails (10.2.4.0)
execjs
autoprefixer-rails (10.4.0.0)
execjs (~> 2)
bcrypt (3.1.16)
better_errors (2.9.1)
coderay (>= 1.0.0)
@ -91,19 +91,20 @@ GEM
bindex (0.8.1)
binding_of_caller (1.0.0)
debug_inspector (>= 0.0.1)
bootstrap (4.6.0)
bootstrap (4.6.1)
autoprefixer-rails (>= 9.1.0)
popper_js (>= 1.14.3, < 2)
sassc-rails (>= 2.0.0)
bootstrap_form (4.5.0)
bootstrap_form (5.0.0)
actionpack (>= 5.2)
activemodel (>= 5.2)
brakeman (5.0.0)
brakeman (5.2.0)
buftok (0.2.0)
builder (3.2.4)
byebug (11.1.3)
capybara (3.35.3)
capybara (3.36.0)
addressable
matrix
mini_mime (>= 0.1.3)
nokogiri (~> 1.8)
rack (>= 1.6.0)
@ -129,16 +130,16 @@ GEM
coffee-script-source (1.12.2)
colorize (0.8.1)
concurrent-ruby (1.1.9)
connection_pool (2.2.3)
connection_pool (2.2.5)
crass (1.0.6)
database_cleaner (2.0.1)
database_cleaner-active_record (~> 2.0.0)
database_cleaner-active_record (2.0.0)
database_cleaner-active_record (2.0.1)
activerecord (>= 5.a)
database_cleaner-core (~> 2.0.0)
database_cleaner-core (2.0.1)
debug_inspector (1.1.0)
devise (4.7.3)
devise (4.8.1)
bcrypt (~> 3.0)
orm_adapter (~> 0.1)
railties (>= 4.1.0)
@ -147,43 +148,57 @@ GEM
devise-async (1.0.0)
activejob (>= 5.0)
devise (>= 4.0)
devise-i18n (1.9.3)
devise (>= 4.7.1)
diff-lcs (1.4.4)
docile (1.3.5)
devise-i18n (1.10.1)
devise (>= 4.8.0)
diff-lcs (1.5.0)
docile (1.4.0)
domain_name (0.5.20190701)
unf (>= 0.0.5, < 1.0.0)
equalizer (0.0.11)
erubi (1.10.0)
excon (0.79.0)
execjs (2.7.0)
factory_bot (6.1.0)
excon (0.89.0)
execjs (2.8.1)
factory_bot (6.2.0)
activesupport (>= 5.0.0)
factory_bot_rails (6.1.0)
factory_bot (~> 6.1.0)
factory_bot_rails (6.2.0)
factory_bot (~> 6.2.0)
railties (>= 5.0.0)
fake_email_validator (1.0.11)
activemodel
mail
faker (2.17.0)
faker (2.19.0)
i18n (>= 1.6, < 2)
faraday (1.3.0)
faraday (1.8.0)
faraday-em_http (~> 1.0)
faraday-em_synchrony (~> 1.0)
faraday-excon (~> 1.1)
faraday-httpclient (~> 1.0.1)
faraday-net_http (~> 1.0)
faraday-net_http_persistent (~> 1.1)
faraday-patron (~> 1.0)
faraday-rack (~> 1.0)
multipart-post (>= 1.2, < 3)
ruby2_keywords
ruby2_keywords (>= 0.0.4)
faraday-em_http (1.0.0)
faraday-em_synchrony (1.0.0)
faraday-excon (1.1.0)
faraday-httpclient (1.0.1)
faraday-net_http (1.0.1)
faraday_middleware (1.0.0)
faraday-net_http_persistent (1.2.0)
faraday-patron (1.0.0)
faraday-rack (1.0.0)
faraday_middleware (1.2.0)
faraday (~> 1.0)
ffi (1.15.0)
ffi (1.15.4)
ffi-compiler (1.0.1)
ffi (>= 1.0.0)
rake
fog-aws (3.10.0)
fog-aws (3.12.0)
fog-core (~> 2.1)
fog-json (~> 1.1)
fog-xml (~> 0.1)
ipaddress (~> 0.8)
fog-core (2.2.3)
fog-core (2.2.4)
builder
excon (~> 0.71)
formatador (~> 0.2)
@ -191,25 +206,25 @@ GEM
fog-json (1.2.0)
fog-core
multi_json (~> 1.10)
fog-local (0.6.0)
fog-local (0.7.0)
fog-core (>= 1.27, < 3.0)
fog-xml (0.1.3)
fog-xml (0.1.4)
fog-core
nokogiri (>= 1.5.11, < 2.0.0)
font-awesome-rails (4.7.0.7)
railties (>= 3.2, < 7)
font-awesome-rails (4.7.0.8)
railties (>= 3.2, < 8.0)
font-kit-rails (1.2.0)
rails
formatador (0.2.5)
globalid (0.5.2)
formatador (0.3.0)
globalid (1.0.0)
activesupport (>= 5.0)
guard (2.16.2)
guard (2.18.0)
formatador (>= 0.2.4)
listen (>= 2.7, < 4.0)
lumberjack (>= 1.0.12, < 2.0)
nenv (~> 0.1)
notiffany (~> 0.0)
pry (>= 0.9.12)
pry (>= 0.13.0)
shellany (~> 0.0)
thor (>= 0.18.1)
guard-brakeman (0.8.6)
@ -217,31 +232,31 @@ GEM
guard (>= 2.0.0)
guard-compat (~> 1.0)
guard-compat (1.2.1)
haml (5.2.1)
haml (5.2.2)
temple (>= 0.8.0)
tilt
haml_lint (0.37.0)
haml_lint (0.37.1)
haml (>= 4.0, < 5.3)
parallel (~> 1.10)
rainbow
rubocop (>= 0.50.0)
sysexits (~> 1.1)
hashie (4.1.0)
hashie (5.0.0)
http (4.4.1)
addressable (~> 2.3)
http-cookie (~> 1.0)
http-form_data (~> 2.2)
http-parser (~> 1.2.0)
http-cookie (1.0.3)
http-cookie (1.0.4)
domain_name (~> 0.5)
http-form_data (2.3.0)
http-parser (1.2.3)
ffi-compiler (>= 1.0, < 2.0)
http_parser.rb (0.6.0)
httparty (0.18.1)
httparty (0.20.0)
mime-types (~> 3.0)
multi_xml (>= 0.5.2)
i18n (1.8.10)
i18n (1.8.11)
concurrent-ruby (~> 1.0)
i18n-js (3.6.0)
i18n (>= 0.6.6)
@ -250,7 +265,8 @@ GEM
mini_magick (>= 4.9.5, < 5)
ruby-vips (>= 2.0.17, < 3)
ipaddress (0.8.3)
jbuilder (2.11.2)
jbuilder (2.11.5)
actionview (>= 5.0.0)
activesupport (>= 5.0.0)
jquery-rails (4.4.0)
rails-dom-testing (>= 1, < 3)
@ -258,64 +274,62 @@ GEM
thor (>= 0.14, < 2.0)
jquery-ui-rails (6.0.1)
railties (>= 3.2.16)
json (2.5.1)
kaminari (1.2.1)
json (2.6.1)
kaminari (1.2.2)
activesupport (>= 4.1.0)
kaminari-actionview (= 1.2.1)
kaminari-activerecord (= 1.2.1)
kaminari-core (= 1.2.1)
kaminari-actionview (1.2.1)
kaminari-actionview (= 1.2.2)
kaminari-activerecord (= 1.2.2)
kaminari-core (= 1.2.2)
kaminari-actionview (1.2.2)
actionview
kaminari-core (= 1.2.1)
kaminari-activerecord (1.2.1)
kaminari-core (= 1.2.2)
kaminari-activerecord (1.2.2)
activerecord
kaminari-core (= 1.2.1)
kaminari-core (1.2.1)
kaminari-core (= 1.2.2)
kaminari-core (1.2.2)
launchy (2.5.0)
addressable (~> 2.7)
letter_opener (1.7.0)
launchy (~> 2.2)
listen (3.5.1)
listen (3.7.0)
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
loofah (2.12.0)
loofah (2.13.0)
crass (~> 1.0.2)
nokogiri (>= 1.5.9)
lumberjack (1.2.8)
mail (2.7.1)
mini_mime (>= 0.1.1)
marcel (1.0.1)
marcel (1.0.2)
matrix (0.4.2)
memoizable (0.4.2)
thread_safe (~> 0.3, >= 0.3.1)
method_source (1.0.0)
mime-types (3.3.1)
mime-types (3.4.1)
mime-types-data (~> 3.2015)
mime-types-data (3.2021.0225)
mime-types-data (3.2021.1115)
mimemagic (0.4.3)
nokogiri (~> 1)
rake
mini_magick (4.11.0)
mini_mime (1.1.1)
mini_mime (1.1.2)
mini_portile2 (2.6.1)
minitest (5.14.4)
minitest (5.15.0)
multi_json (1.15.0)
multi_xml (0.6.0)
multipart-post (2.1.1)
naught (1.1.0)
nenv (0.3.0)
nested_form (0.3.2)
newrelic_rpm (6.15.0)
nio4r (2.5.8)
nokogiri (1.12.5)
mini_portile2 (~> 2.6.1)
racc (~> 1.4)
nokogumbo (2.0.5)
nokogiri (~> 1.8, >= 1.8.4)
notiffany (0.1.3)
nenv (~> 0.1)
shellany (~> 0.0)
oauth (0.5.6)
omniauth (2.0.3)
oauth (0.5.8)
omniauth (2.0.4)
hashie (>= 3.4.6)
rack (>= 1.6.2, < 3)
rack-protection
@ -332,32 +346,32 @@ GEM
omniauth-oauth (~> 1.1)
rack
orm_adapter (0.5.0)
parallel (1.20.1)
parser (3.0.0.0)
parallel (1.21.0)
parser (3.0.3.2)
ast (~> 2.4.1)
pg (1.2.3)
pghero (2.8.1)
pghero (2.8.2)
activerecord (>= 5)
poltergeist (1.18.1)
capybara (>= 2.1, < 4)
cliver (~> 0.3.1)
websocket-driver (>= 0.2.0)
popper_js (1.16.0)
pry (0.14.0)
pry (0.14.1)
coderay (~> 1.1)
method_source (~> 1.0)
public_suffix (4.0.6)
puma (5.5.1)
puma (5.5.2)
nio4r (~> 2.0)
questiongenerator (1.0.0)
racc (1.5.2)
racc (1.6.0)
rack (2.2.3)
rack-pjax (1.1.0)
nokogiri (~> 1.5)
rack (>= 1.1)
rack-protection (2.1.0)
rack
rack-proxy (0.6.5)
rack-proxy (0.7.0)
rack
rack-test (1.1.0)
rack (>= 1.0, < 3)
@ -386,7 +400,7 @@ GEM
rails-i18n (5.1.3)
i18n (>= 0.7, < 2)
railties (>= 5.0, < 6)
rails_admin (2.1.1)
rails_admin (2.2.1)
activemodel-serializers-xml (>= 1.0)
builder (~> 3.1)
haml (>= 4.0, < 6)
@ -406,12 +420,12 @@ GEM
thor (>= 0.19.0, < 2.0)
rainbow (3.0.0)
rake (13.0.6)
rb-fsevent (0.10.4)
rb-fsevent (0.11.0)
rb-inotify (0.10.1)
ffi (~> 1.0)
redcarpet (3.5.1)
redis (4.1.4)
regexp_parser (2.1.1)
regexp_parser (2.2.0)
remotipart (1.4.4)
responders (3.0.1)
actionpack (>= 5.0)
@ -419,10 +433,10 @@ GEM
rexml (3.2.5)
rolify (5.3.0)
rotp (6.2.0)
rqrcode (1.2.0)
rqrcode (2.1.0)
chunky_png (~> 1.0)
rqrcode_core (~> 0.2)
rqrcode_core (0.2.0)
rqrcode_core (~> 1.0)
rqrcode_core (1.2.0)
rspec-core (3.9.3)
rspec-support (~> 3.9.3)
rspec-expectations (3.9.4)
@ -446,25 +460,24 @@ GEM
rspec-core (~> 3.0, >= 3.0.0)
sidekiq (>= 2.4.0)
rspec-support (3.9.4)
rubocop (1.12.0)
rubocop (1.24.0)
parallel (~> 1.10)
parser (>= 3.0.0.0)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml
rubocop-ast (>= 1.2.0, < 2.0)
rubocop-ast (>= 1.15.0, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 3.0)
rubocop-ast (1.4.1)
parser (>= 2.7.1.5)
rubocop-ast (1.15.1)
parser (>= 3.0.1.1)
ruby-progressbar (1.11.0)
ruby-vips (2.1.0)
ruby-vips (2.1.4)
ffi (~> 1.12)
ruby2_keywords (0.0.4)
sanitize (5.2.3)
ruby2_keywords (0.0.5)
sanitize (6.0.0)
crass (~> 1.0.2)
nokogiri (>= 1.8.0)
nokogumbo (~> 2.0)
nokogiri (>= 1.12.0)
sass (3.7.4)
sass-listen (~> 4.0.0)
sass-listen (4.0.0)
@ -485,6 +498,19 @@ GEM
sprockets-rails
tilt
semantic_range (3.0.0)
sentry-rails (4.8.1)
railties (>= 5.0)
sentry-ruby-core (~> 4.8.1)
sentry-ruby (4.8.1)
concurrent-ruby (~> 1.0, >= 1.0.2)
faraday (>= 1.0)
sentry-ruby-core (= 4.8.1)
sentry-ruby-core (4.8.1)
concurrent-ruby
faraday
sentry-sidekiq (4.8.1)
sentry-ruby-core (~> 4.8.1)
sidekiq (>= 3.0)
shellany (0.0.1)
sidekiq (5.2.9)
connection_pool (~> 2.2, >= 2.2.2)
@ -496,20 +522,21 @@ GEM
docile (~> 1.1)
simplecov-html (~> 0.11)
simplecov_json_formatter (~> 0.1)
simplecov-cobertura (1.4.2)
simplecov (~> 0.8)
simplecov-cobertura (2.1.0)
rexml
simplecov (~> 0.19)
simplecov-html (0.12.3)
simplecov-json (0.2.3)
json
simplecov
simplecov_json_formatter (0.1.2)
simplecov_json_formatter (0.1.3)
spring (2.1.1)
sprockets (3.7.2)
concurrent-ruby (~> 1.0)
rack (> 1, < 3)
sprockets-rails (3.2.2)
actionpack (>= 4.0)
activesupport (>= 4.0)
sprockets-rails (3.4.2)
actionpack (>= 5.2)
activesupport (>= 5.2)
sprockets (>= 3.0.0)
sysexits (1.2.0)
temple (0.8.2)
@ -539,8 +566,8 @@ GEM
execjs (>= 0.3.0, < 3)
unf (0.1.4)
unf_ext
unf_ext (0.0.7.7)
unicode-display_width (2.0.0)
unf_ext (0.0.8)
unicode-display_width (2.1.0)
warden (1.2.9)
rack (>= 2.0.9)
web-console (3.7.0)
@ -548,7 +575,7 @@ GEM
activemodel (>= 5.0)
bindex (>= 0.4.0)
railties (>= 5.0)
webpacker (5.2.1)
webpacker (5.4.3)
activesupport (>= 5.2)
rack-proxy (>= 0.6.1)
railties (>= 5.2)
@ -596,7 +623,6 @@ DEPENDENCIES
jbuilder (~> 2.10)
letter_opener
mini_magick
newrelic_rpm
omniauth
omniauth-rails_csrf_protection (~> 1.0)
omniauth-tumblr
@ -622,6 +648,9 @@ DEPENDENCIES
ruby-progressbar
sanitize
sass-rails (~> 5.0)
sentry-rails
sentry-ruby
sentry-sidekiq
sidekiq (< 6)
simplecov
simplecov-cobertura

View File

@ -41,7 +41,7 @@ class Ajax::AnswerController < AjaxController
current_user.answer question, params[:answer]
end
rescue => e
NewRelic::Agent.notice_error(e)
Sentry.capture_exception(e)
@response[:status] = :err
@response[:message] = I18n.t('messages.error')
return

View File

@ -8,7 +8,7 @@ class Ajax::CommentController < AjaxController
begin
current_user.comment(answer, params[:comment])
rescue ActiveRecord::RecordInvalid => e
NewRelic::Agent.notice_error(e)
Sentry.capture_exception(e)
@response[:status] = :rec_inv
@response[:message] = I18n.t('messages.comment.create.rec_inv')
return

View File

@ -7,7 +7,7 @@ class Ajax::FriendController < AjaxController
begin
current_user.follow target_user
rescue => e
NewRelic::Agent.notice_error(e)
Sentry.capture_exception(e)
@response[:status] = :fail
@response[:message] = I18n.t('messages.friend.create.fail')
return
@ -26,7 +26,7 @@ class Ajax::FriendController < AjaxController
begin
current_user.unfollow target_user
rescue => e
NewRelic::Agent.notice_error(e)
Sentry.capture_exception(e)
@response[:status] = :fail
@response[:message] = I18n.t('messages.friend.destroy.fail')
return

View File

@ -34,7 +34,7 @@ class Ajax::InboxController < AjaxController
begin
inbox.remove
rescue => e
NewRelic::Agent.notice_error(e)
Sentry.capture_exception(e)
@response[:status] = :err
@response[:message] = I18n.t('messages.error')
return
@ -51,7 +51,7 @@ class Ajax::InboxController < AjaxController
begin
Inbox.where(user: current_user).each { |i| i.remove }
rescue => e
NewRelic::Agent.notice_error(e)
Sentry.capture_exception(e)
@response[:status] = :err
@response[:message] = I18n.t('messages.error')
return
@ -69,7 +69,7 @@ class Ajax::InboxController < AjaxController
.where(questions: { user_id: @target_user.id, author_is_anonymous: false })
@inbox.each { |i| i.remove }
rescue => e
NewRelic::Agent.notice_error(e)
Sentry.capture_exception(e)
@response[:status] = :err
@response[:message] = I18n.t('messages.error')
return

View File

@ -11,7 +11,7 @@ class Ajax::ListController < AjaxController
begin
params.require :name
rescue ActionController::ParameterMissing => e
NewRelic::Agent.notice_error(e)
Sentry.capture_exception(e)
@response[:status] = :toolong
@response[:message] = I18n.t('messages.list.create.noname')
return
@ -22,17 +22,17 @@ class Ajax::ListController < AjaxController
target_user = User.find_by_screen_name!(params[:user])
list = List.create! user: current_user, display_name: params[:name]
rescue ActiveRecord::RecordInvalid => e
NewRelic::Agent.notice_error(e)
Sentry.capture_exception(e)
@response[:status] = :toolong
@response[:message] = I18n.t('messages.list.create.toolong')
return
rescue ActiveRecord::RecordNotFound => e
NewRelic::Agent.notice_error(e)
Sentry.capture_exception(e)
@response[:status] = :notfound
@response[:message] = I18n.t('messages.list.create.notfound')
return
rescue ActiveRecord::RecordNotUnique => e
NewRelic::Agent.notice_error(e)
Sentry.capture_exception(e)
@response[:status] = :exists
@response[:message] = I18n.t('messages.list.create.exists')
return
@ -58,7 +58,7 @@ class Ajax::ListController < AjaxController
begin
List.where(user: current_user, name: params[:list]).first.destroy!
rescue ActiveRecord::RecordNotFound => e
NewRelic::Agent.notice_error(e)
Sentry.capture_exception(e)
@response[:status] = :notfound
@response[:message] = I18n.t('messages.list.destroy.notfound')
return
@ -87,7 +87,7 @@ class Ajax::ListController < AjaxController
begin
list = current_user.lists.find_by_name!(params[:list])
rescue ActiveRecord::RecordNotFound => e
NewRelic::Agent.notice_error(e)
Sentry.capture_exception(e)
@response[:status] = :notfound
@response[:message] = I18n.t('messages.list.membership.notfound')
return

View File

@ -8,7 +8,7 @@ class Ajax::ModerationController < AjaxController
begin
current_user.report_vote(report, params[:upvote])
rescue => e
NewRelic::Agent.notice_error(e)
Sentry.capture_exception(e)
@response[:status] = :fail
@response[:message] = I18n.t('messages.moderation.vote.fail')
return
@ -28,7 +28,7 @@ class Ajax::ModerationController < AjaxController
begin
current_user.report_unvote report
rescue => e
NewRelic::Agent.notice_error(e)
Sentry.capture_exception(e)
@response[:status] = :fail
@response[:message] = I18n.t('messages.moderation.destroy_vote.fail')
return
@ -49,7 +49,7 @@ class Ajax::ModerationController < AjaxController
report.deleted = true
report.save
rescue => e
NewRelic::Agent.notice_error(e)
Sentry.capture_exception(e)
@response[:status] = :fail
@response[:message] = I18n.t('messages.moderation.destroy_report.fail')
return
@ -70,7 +70,7 @@ class Ajax::ModerationController < AjaxController
begin
current_user.report_comment(report, params[:comment])
rescue ActiveRecord::RecordInvalid => e
NewRelic::Agent.notice_error(e)
Sentry.capture_exception(e)
@response[:status] = :rec_inv
@response[:message] = I18n.t('messages.moderation.create_comment.rec_inv')
return

View File

@ -35,7 +35,7 @@ class Ajax::QuestionController < AjaxController
user: current_user,
direct: params[:rcpt] != 'followers')
rescue ActiveRecord::RecordInvalid => e
NewRelic::Agent.notice_error(e)
Sentry.capture_exception(e)
@response[:status] = :rec_inv
@response[:message] = I18n.t('messages.question.create.rec_inv')
return

View File

@ -7,7 +7,7 @@ class Ajax::SmileController < AjaxController
begin
current_user.smile answer
rescue => e
NewRelic::Agent.notice_error(e)
Sentry.capture_exception(e)
@response[:status] = :fail
@response[:message] = I18n.t('messages.smile.create.fail')
return
@ -26,7 +26,7 @@ class Ajax::SmileController < AjaxController
begin
current_user.unsmile answer
rescue => e
NewRelic::Agent.notice_error(e)
Sentry.capture_exception(e)
@response[:status] = :fail
@response[:message] = I18n.t('messages.smile.destroy.fail')
return
@ -45,7 +45,7 @@ class Ajax::SmileController < AjaxController
begin
current_user.smile_comment comment
rescue => e
NewRelic::Agent.notice_error(e)
Sentry.capture_exception(e)
@response[:status] = :fail
@response[:message] = I18n.t('messages.smile.create_comment.fail')
return
@ -64,7 +64,7 @@ class Ajax::SmileController < AjaxController
begin
current_user.unsmile_comment comment
rescue => e
NewRelic::Agent.notice_error(e)
Sentry.capture_exception(e)
@response[:status] = :fail
@response[:message] = I18n.t('messages.smile.destroy_comment.fail')
return

View File

@ -7,7 +7,7 @@ class AjaxController < ApplicationController
respond_to :json
rescue_from(StandardError) do |e|
NewRelic::Agent.notice_error(e)
Sentry.capture_exception(e)
@response = {
success: false,
@ -19,7 +19,7 @@ class AjaxController < ApplicationController
end
rescue_from(ActiveRecord::RecordNotFound) do |e|
NewRelic::Agent.notice_error(e)
Sentry.capture_exception(e)
@response = {
success: false,
@ -31,7 +31,7 @@ class AjaxController < ApplicationController
end
rescue_from(ActionController::ParameterMissing) do |e|
NewRelic::Agent.notice_error(e)
Sentry.capture_exception(e)
@response = {
success: false,

View File

@ -3,6 +3,7 @@ class ApplicationController < ActionController::Base
# For APIs, you may want to use :null_session instead.
protect_from_forgery with: :exception
before_action :sentry_user_context
before_action :configure_permitted_parameters, if: :devise_controller?
before_action :check_locale
before_action :banned?
@ -64,4 +65,12 @@ class ApplicationController < ActionController::Base
devise_parameter_sanitizer.permit(:sign_in) { |u| u.permit(:login, :screen_name, :email, :password, :remember_me) }
devise_parameter_sanitizer.permit(:account_update) { |u| u.permit(:screen_name, :email, :password, :password_confirmation, :current_password) }
end
def sentry_user_context
if current_user.present?
Sentry.set_user({ id: current_user.id })
else
Sentry.set_user({ ip_address: request.ip })
end
end
end

View File

@ -32,7 +32,7 @@ class InboxController < ApplicationController
.zero?
end
rescue => e
NewRelic::Agent.notice_error(e)
Sentry.capture_exception(e)
flash.now[:error] = "No user with the name @#{params[:author]} found, showing default entries instead!"
@not_found = true
end

View File

@ -9,7 +9,7 @@ class DeletionWorker
User.find(resource_id).destroy!
rescue => e
logger.info "failed to delete user: #{e.message}"
NewRelic::Agent.notice_error(e)
Sentry.capture_exception(e)
end
end
end

View File

@ -15,6 +15,6 @@ class QuestionWorker
end
rescue StandardError => e
logger.info "failed to ask question: #{e.message}"
NewRelic::Agent.notice_error(e)
Sentry.capture_exception(e)
end
end

View File

@ -25,7 +25,7 @@ class ShareWorker
return
rescue => e
logger.info "failed to post answer #{answer_id} to #{service} for user #{user_id}: #{e.message}"
NewRelic::Agent.notice_error(e)
Sentry.capture_exception(e)
raise
end
end

View File

@ -0,0 +1,11 @@
return unless APP_CONFIG[:sentry_dsn]
Sentry.init do |config|
config.dsn = APP_CONFIG[:sentry_dsn]
config.breadcrumbs_logger = [:active_support_logger, :http_logger]
# Set tracesSampleRate to 1.0 to capture 100%
# of transactions for performance monitoring.
# We recommend adjusting this value in production
config.traces_sample_rate = 1.0
end

View File

@ -72,3 +72,6 @@ accepted_image_formats:
- .png
- image/gif
- .gif
# Sentry connection string
sentry_dsn: ''

View File

@ -1,48 +0,0 @@
#
# This file configures the New Relic Agent. New Relic monitors Ruby, Java,
# .NET, PHP, Python and Node applications with deep visibility and low
# overhead. For more information, visit www.newrelic.com.
#
# Generated June 17, 2017
#
# This configuration file is custom generated for Retrospring
#
# For full documentation of agent configuration options, please refer to
# https://docs.newrelic.com/docs/agents/ruby-agent/installation-configuration/ruby-agent-configuration
common: &default_settings
# Required license key associated with your New Relic account.
license_key: CHANGEME
# Your application name. Renaming here affects where data displays in New
# Relic. For more details, see https://docs.newrelic.com/docs/apm/new-relic-apm/maintenance/renaming-applications
app_name: Retrospring
# To disable the agent regardless of other settings, uncomment the following:
# agent_enabled: false
# Logging level for log/newrelic_agent.log
log_level: info
# disabling browser monitoring for data privacy concerns
browser_monitoring:
auto_instrument: false
# Environment-specific settings are in this section.
# RAILS_ENV or RACK_ENV (as appropriate) is used to determine the environment.
# If your application has other named environments, configure them here.
development:
<<: *default_settings
app_name: Retrospring (Development)
test:
<<: *default_settings
# It doesn't make sense to report to New Relic from automated test runs.
monitor_mode: false
staging:
<<: *default_settings
app_name: Retrospring (Staging)
production:
<<: *default_settings

View File

@ -26,7 +26,7 @@ class Exporter
finalize
publish
rescue => e
NewRelic::Agent.notice_error(e)
Sentry.capture_exception(e)
@user.export_processing = false
@user.save validate: false
end