diff --git a/Gemfile b/Gemfile index f2bcb23..bcb66ab 100644 --- a/Gemfile +++ b/Gemfile @@ -40,6 +40,10 @@ gem "bootsnap", require: false # Use Active Storage variants [https://guides.rubyonrails.org/active_storage_overview.html#transforming-images] # gem "image_processing", "~> 1.2" +# Monitor errors and performance +gem "sentry-ruby" +gem "sentry-rails" + # Add optimized Active Record association methods gem "activerecord-has_some_of_many" diff --git a/Gemfile.lock b/Gemfile.lock index 23d81ff..f9c16af 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -488,6 +488,12 @@ GEM rexml (~> 3.2, >= 3.2.5) rubyzip (>= 1.2.2, < 3.0) websocket (~> 1.0) + sentry-rails (5.22.4) + railties (>= 5.0) + sentry-ruby (~> 5.22.4) + sentry-ruby (5.22.4) + bigdecimal + concurrent-ruby (~> 1.0, >= 1.0.2) shellany (0.0.1) shoulda-matchers (6.4.0) activesupport (>= 5.2.0) @@ -603,6 +609,8 @@ DEPENDENCIES rubocop-rspec rubocop-rspec_rails selenium-webdriver (~> 4.27) + sentry-rails + sentry-ruby shoulda-matchers solid_cable solid_cache diff --git a/config/initializers/sentry.rb b/config/initializers/sentry.rb new file mode 100644 index 0000000..977def5 --- /dev/null +++ b/config/initializers/sentry.rb @@ -0,0 +1,13 @@ +Sentry.init do |config| + return unless Rails.env.production? + + config.dsn = "https://cb48a87a9a7c2f33bf362a8d91c0a594@sentry.incubateur.net/218" + 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 = 0.005 + + config.release = ENV["CONTAINER_VERSION"] if ENV["CONTAINER_VERSION"].present? +end