From c312dcb9594bbdcd4a976d2e4d6fe77c1cab493d Mon Sep 17 00:00:00 2001 From: Max Fierke Date: Sun, 5 Nov 2023 18:33:33 -0600 Subject: [PATCH] Add sentry for production use (if SENTRY_DSN set) --- Gemfile | 3 +++ Gemfile.lock | 7 +++++++ config/initializers/sentry.rb | 7 +++++++ 3 files changed, 17 insertions(+) create mode 100644 config/initializers/sentry.rb diff --git a/Gemfile b/Gemfile index e2d4d1dc..86ea33b2 100644 --- a/Gemfile +++ b/Gemfile @@ -53,6 +53,9 @@ group :production do gem 'aws-sdk-s3', require: false gem 'redis' gem 'hiredis-client' + + gem 'sentry-ruby' + gem 'sentry-rails' end group :development, :test do diff --git a/Gemfile.lock b/Gemfile.lock index 3988a996..a96e7303 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -301,6 +301,11 @@ GEM rexml (~> 3.2, >= 3.2.5) rubyzip (>= 1.2.2, < 3.0) websocket (~> 1.0) + sentry-rails (5.12.0) + railties (>= 5.0) + sentry-ruby (~> 5.12.0) + sentry-ruby (5.12.0) + concurrent-ruby (~> 1.0, >= 1.0.2) sidekiq (7.2.0) concurrent-ruby (< 2) connection_pool (>= 2.3.0) @@ -369,6 +374,8 @@ DEPENDENCIES redis rspec-rails (~> 6.0) selenium-webdriver (~> 4.14) + sentry-rails + sentry-ruby sidekiq (< 8) sidekiq-failures sprockets-rails diff --git a/config/initializers/sentry.rb b/config/initializers/sentry.rb new file mode 100644 index 00000000..8883707a --- /dev/null +++ b/config/initializers/sentry.rb @@ -0,0 +1,7 @@ +if ENV["SENTRY_DSN"].present? + Sentry.init do |config| + config.dsn = ENV["SENTRY_DSN"] + config.breadcrumbs_logger = [:active_support_logger, :http_logger] + config.traces_sample_rate = 0.6 + end +end