From 1dc925ee9e38cc27f53f2efbc35e356466021c65 Mon Sep 17 00:00:00 2001 From: Etienne Ischer Date: Fri, 13 Aug 2021 19:30:34 +0200 Subject: [PATCH] upgrade sentry gems, enable async and disable performance analyses --- Gemfile | 5 +++-- Gemfile.lock | 22 +++++++++++++--------- app/workers/sentry_worker.rb | 9 +++++++++ config/initializers/sentry.rb | 10 ++-------- 4 files changed, 27 insertions(+), 19 deletions(-) create mode 100644 app/workers/sentry_worker.rb diff --git a/Gemfile b/Gemfile index 9e0fd48..1057c64 100644 --- a/Gemfile +++ b/Gemfile @@ -41,8 +41,9 @@ gem 'omniauth-rails_csrf_protection', '~> 1.0.0' # A Ruby wrapper around Blizzard's Game Data and Profile APIs gem 'rbattlenet', '~> 2.2.9', git: 'https://github.com/Dainii/rbattlenet' # A gem that provides Rails integration for the Sentry error logger -gem 'sentry-rails', '~> 4.4.0' -gem 'sentry-ruby', '~> 4.4.2' +gem 'sentry-rails', '~> 4.6.5' +gem 'sentry-ruby', '~> 4.6.5' +gem 'sentry-sidekiq', '~> 4.6.5' # Simple, efficient background processing for Ruby gem 'sidekiq', '~> 6.2.1' # Agnostic pagination in plain ruby diff --git a/Gemfile.lock b/Gemfile.lock index 334fd75..d4b069c 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -164,7 +164,7 @@ GEM activesupport (>= 4) railties (>= 4) request_store (~> 1.0) - loofah (2.11.0) + loofah (2.12.0) crass (~> 1.0.2) nokogiri (>= 1.5.9) mail (2.7.1) @@ -181,7 +181,7 @@ GEM multi_xml (0.6.0) multipart-post (2.1.1) nio4r (2.5.8) - nokogiri (1.12.2-x86_64-linux) + nokogiri (1.12.3-x86_64-linux) racc (~> 1.4) oauth2 (1.4.7) faraday (>= 0.8, < 2.0) @@ -327,16 +327,19 @@ GEM childprocess (>= 0.5, < 4.0) rubyzip (>= 1.2.2) semantic_range (3.0.0) - sentry-rails (4.4.0) + sentry-rails (4.6.5) railties (>= 5.0) - sentry-ruby-core (~> 4.4.0.pre.beta) - sentry-ruby (4.4.2) + sentry-ruby-core (~> 4.6.0) + sentry-ruby (4.6.5) concurrent-ruby (~> 1.0, >= 1.0.2) faraday (>= 1.0) - sentry-ruby-core (= 4.4.2) - sentry-ruby-core (4.4.2) + sentry-ruby-core (= 4.6.5) + sentry-ruby-core (4.6.5) concurrent-ruby faraday + sentry-sidekiq (4.6.5) + sentry-ruby-core (~> 4.6.0) + sidekiq (>= 3.0) sidekiq (6.2.1) connection_pool (>= 2.2.2) rack (~> 2.0) @@ -438,8 +441,9 @@ DEPENDENCIES rubocop-rails sass-rails (>= 6) selenium-webdriver - sentry-rails (~> 4.4.0) - sentry-ruby (~> 4.4.2) + sentry-rails (~> 4.6.5) + sentry-ruby (~> 4.6.5) + sentry-sidekiq (~> 4.6.5) sidekiq (~> 6.2.1) simplecov solargraph diff --git a/app/workers/sentry_worker.rb b/app/workers/sentry_worker.rb new file mode 100644 index 0000000..90acec8 --- /dev/null +++ b/app/workers/sentry_worker.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +class SentryWorker + include Sidekiq::Worker + + def perform(event, hint) + Sentry.send_event(event, hint) + end +end diff --git a/config/initializers/sentry.rb b/config/initializers/sentry.rb index 34bb19c..00350ce 100644 --- a/config/initializers/sentry.rb +++ b/config/initializers/sentry.rb @@ -1,13 +1,7 @@ Sentry.init do |config| config.dsn = ENV['SENTRY_DSN'] - config.breadcrumbs_logger = [:active_support_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 - # or - config.traces_sampler = lambda do |context| - true + config.async = lambda do |event, hint| + SentryWorker.perform_async(event, hint) end end