Skip to content

Commit

Permalink
AO3-6742 Replace New Relic with Sentry (#4865)
Browse files Browse the repository at this point in the history
  • Loading branch information
brianjaustin authored Jul 25, 2024
1 parent 121c964 commit 26e80a8
Show file tree
Hide file tree
Showing 9 changed files with 50 additions and 274 deletions.
4 changes: 2 additions & 2 deletions ACKNOWLEDGMENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Acknowledgments
<p><a href="http://galeracluster.com/products/"><img alt="" valign="middle" src="http://media.archiveofourown.org/ao3/logos/galera.png" width="200"/> Galera Cluster</a> for clustered MySQL.</p>
<p><a href="github.com/otwcode/otwarchive"><img alt="" valign="middle" src="http://media.archiveofourown.org/ao3/logos/GitHub_Logo.png" width="200"/> GitHub</a> for collaborative programming.</p>
<p><a href="http://www.haproxy.org/"><img alt="" valign="middle" src="http://media.archiveofourown.org/ao3/logos/logo-med.png" width="200"/> HAProxy</a> for load balancing.</p>
<p><a href="https://houndci.com/"><img alt="" valign="middle" src="http://media.archiveofourown.org/ao3/logos/Hound-Dribbble.png" width="200"/> Hound</a> for style guidance.</p>
<p><a href="https://houndci.com/"><img alt="" valign="middle" src="http://media.archiveofourown.org/ao3/logos/Hound-Dribbble.png" width="200"/> Hound</a> and <a href="https://github.com/reviewdog/reviewdog"><img alt="reviewdog logo" valign="middle" src="https://raw.githubusercontent.com/haya14busa/i/d598ed7dc49fefb0018e422e4c43e5ab8f207a6b/reviewdog/reviewdog.logo.png" width="200"/> reviewdog</a> for style guidance.</p>
<p><a href="https://otwarchive.atlassian.net/"><img alt="" valign="middle" src="http://media.archiveofourown.org/ao3/logos/jira_rgb_blue.svg" width="200"/> Jira</a> for our issue tracking.</p>
<p><a href="https://nginx.org/en/"><img alt="" valign="middle" src="http://media.archiveofourown.org/ao3/logos/Nginx_logo.svg" width="200"/> NGINX</a> for our front end.</p>
<p><a href="https://memcached.org/"><img alt="" valign="middle" src="http://media.archiveofourown.org/ao3/logos/Memcached.png" width="200"/> Memcached</a> for caching.</p>
Expand All @@ -23,5 +23,5 @@ Acknowledgments
<p><a href="http://rspec.info/"><img alt="" valign="middle" src="http://media.archiveofourown.org/ao3/logos/rspec.png" width="200"/> RSpec</a> for unit tests.</p>
<p><a href="https://www.ruby-lang.org/en/"><img alt="" valign="middle" src="http://media.archiveofourown.org/ao3/logos/ruby.png" width="200"/> Ruby</a> as our language.</p>
<p><a href="https://www.jetbrains.com/ruby/"><img alt="" valign="middle" src="http://media.archiveofourown.org/ao3/logos/logo_RubyMine.svg" width="200"/> RubyMine</a> for our integrated development environment.</p>
<p><a href="https://sentry.io/"><svg class="css-lfbo6j e1igk8x04" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 222 66" width="200" height="60"><path d="M29,2.26a4.67,4.67,0,0,0-8,0L14.42,13.53A32.21,32.21,0,0,1,32.17,40.19H27.55A27.68,27.68,0,0,0,12.09,17.47L6,28a15.92,15.92,0,0,1,9.23,12.17H4.62A.76.76,0,0,1,4,39.06l2.94-5a10.74,10.74,0,0,0-3.36-1.9l-2.91,5a4.54,4.54,0,0,0,1.69,6.24A4.66,4.66,0,0,0,4.62,44H19.15a19.4,19.4,0,0,0-8-17.31l2.31-4A23.87,23.87,0,0,1,23.76,44H36.07a35.88,35.88,0,0,0-16.41-31.8l4.67-8a.77.77,0,0,1,1.05-.27c.53.29,20.29,34.77,20.66,35.17a.76.76,0,0,1-.68,1.13H40.6q.09,1.91,0,3.81h4.78A4.59,4.59,0,0,0,50,39.43a4.49,4.49,0,0,0-.62-2.28Z M124.32,28.28,109.56,9.22h-3.68V34.77h3.73V15.19l15.18,19.58h3.26V9.22h-3.73ZM87.15,23.54h13.23V20.22H87.14V12.53h14.93V9.21H83.34V34.77h18.92V31.45H87.14ZM71.59,20.3h0C66.44,19.06,65,18.08,65,15.7c0-2.14,1.89-3.59,4.71-3.59a12.06,12.06,0,0,1,7.07,2.55l2-2.83a14.1,14.1,0,0,0-9-3c-5.06,0-8.59,3-8.59,7.27,0,4.6,3,6.19,8.46,7.52C74.51,24.74,76,25.78,76,28.11s-2,3.77-5.09,3.77a12.34,12.34,0,0,1-8.3-3.26l-2.25,2.69a15.94,15.94,0,0,0,10.42,3.85c5.48,0,9-2.95,9-7.51C79.75,23.79,77.47,21.72,71.59,20.3ZM195.7,9.22l-7.69,12-7.64-12h-4.46L186,24.67V34.78h3.84V24.55L200,9.22Zm-64.63,3.46h8.37v22.1h3.84V12.68h8.37V9.22H131.08ZM169.41,24.8c3.86-1.07,6-3.77,6-7.63,0-4.91-3.59-8-9.38-8H154.67V34.76h3.8V25.58h6.45l6.48,9.2h4.44l-7-9.82Zm-10.95-2.5V12.6h7.17c3.74,0,5.88,1.77,5.88,4.84s-2.29,4.86-5.84,4.86Z" transform="translate(11, 11)" fill="#362d59"></path></svg> Sentry</a> for APM/application monitoring.</p>
<p><a href="https://slack.com/"><img alt="" valign="middle" src="http://media.archiveofourown.org/ao3/logos/Slack_RGB.svg" width="200"/> Slack</a> for communications.</p>
<p><a href="https://www.vagrantup.com/"><img alt="" valign="middle" src="http://media.archiveofourown.org/ao3/logos/logo_wide-56017ded.png" width="200"/> Vagrant</a> for our development environment.</p>
15 changes: 4 additions & 11 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,6 @@ gem 'escape_utils', '1.2.1'

gem 'timeliness'

# TODO: rpm_contrib is deprecated and needs to be replaced
# Here is a list of possible alternatives:
# https://github.com/newrelic/extends_newrelic_rpm
#
# The last working version is not compatible with Rails 5
#
# gem 'rpm_contrib', '2.2.0'

# for generating graphs
gem 'google_visualr', git: 'https://github.com/winston/google_visualr'

Expand Down Expand Up @@ -184,7 +176,8 @@ gem 'unicorn', '~> 5.5', require: false
gem 'god', '~> 0.13.7'

group :staging, :production do
# Place the New Relic gem as low in the list as possible, allowing the
# frameworks above it to be instrumented when the gem initializes.
gem "newrelic_rpm"
gem "stackprof"
gem "sentry-ruby"
gem "sentry-rails"
gem "sentry-resque"
end
16 changes: 14 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,6 @@ GEM
net-ssh-gateway (2.0.0)
net-ssh (>= 4.0.0)
netrc (0.11.0)
newrelic_rpm (9.7.1)
nio4r (2.7.0)
nkf (0.2.0)
nokogiri (1.16.5)
Expand Down Expand Up @@ -553,6 +552,15 @@ GEM
rexml (~> 3.2, >= 3.2.5)
rubyzip (>= 1.2.2, < 3.0)
websocket (~> 1.0)
sentry-rails (5.18.0)
railties (>= 5.0)
sentry-ruby (~> 5.18.0)
sentry-resque (5.18.0)
resque (>= 1.24)
sentry-ruby (~> 5.18.0)
sentry-ruby (5.18.0)
bigdecimal
concurrent-ruby (~> 1.0, >= 1.0.2)
shoulda (4.0.0)
shoulda-context (~> 2.0)
shoulda-matchers (~> 4.0)
Expand All @@ -577,6 +585,7 @@ GEM
sprockets (3.7.2)
concurrent-ruby (~> 1.0)
rack (> 1, < 3)
stackprof (0.2.26)
stringex (2.8.6)
strscan (3.1.0)
sys-uname (1.2.3)
Expand Down Expand Up @@ -684,7 +693,6 @@ DEPENDENCIES
minitest
mysql2
n_plus_one_control
newrelic_rpm
nokogiri (>= 1.8.5)
permit_yo
phraseapp-in-context-editor-ruby (>= 1.0.6)
Expand All @@ -711,10 +719,14 @@ DEPENDENCIES
rvm-capistrano
sanitize (>= 4.6.5)
selenium-webdriver
sentry-rails
sentry-resque
sentry-ruby
shoulda
simplecov
simplecov-cobertura
sprockets (< 4)
stackprof
terrapin
test-unit (~> 3.2)
timecop
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ We benefit from software and services that are free to use for Open Source proje
* [Codeship](https://codeship.com/)
* [Hound](https://houndci.com/) by [thoughtbot](https://thoughtbot.com/)
* [BrowserStack](https://www.browserstack.com)
* [Sentry](https://sentry.io)
* [Full list of acknowledgments](ACKNOWLEDGMENTS.md)

Thank you kindly!
1 change: 0 additions & 1 deletion config/deploy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -139,4 +139,3 @@
after "deploy:restart", "deploy:restart_workers"
after "deploy:restart", "deploy:restart_schedulers"
after "deploy:symlink", "deploy:update_configs"
after "deploy:update", "newrelic:notice_deployment"
2 changes: 0 additions & 2 deletions config/initializers/gem-plugin_config/newrelic.rb

This file was deleted.

29 changes: 0 additions & 29 deletions config/initializers/new_relic.rb

This file was deleted.

29 changes: 29 additions & 0 deletions config/initializers/sentry.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# frozen_string_literal: true

if Rails.env.production? || Rails.env.staging?
Sentry.init do |config|
# get breadcrumbs from logs
config.breadcrumbs_logger = [:active_support_logger, :http_logger]

# enable tracing
config.traces_sampler = lambda do |sampling_context|
next sampling_context[:parent_sampled] unless sampling_context[:parent_sampled].nil?

rack_env = sampling_context[:env]
rate_from_nginx = Float(rack_env["HTTP_X_SENTRY_RATE"], exception: false)
return rate_from_nginx if rate_from_nginx
return 0.01 if Rails.env.production?
return 1.00 if Rails.env.staging?

# Default to off for other environments when no override is present
0.0
end

# enable profiling
# this is relative to traces_sample_rate
config.profiles_sample_rate = 1.0

config.environment = Rails.env
config.release = ArchiveConfig.REVISION.to_s
end
end
Loading

0 comments on commit 26e80a8

Please sign in to comment.