diff --git a/Gemfile b/Gemfile index 63b0293..3e11698 100644 --- a/Gemfile +++ b/Gemfile @@ -77,3 +77,8 @@ group :test do gem "capybara" gem "selenium-webdriver" end + +group :production do + gem "sentry-ruby" + gem "sentry-rails" +end diff --git a/Gemfile.lock b/Gemfile.lock index 360d185..f59e60e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -374,6 +374,12 @@ GEM rexml (~> 3.2, >= 3.2.5) rubyzip (>= 1.2.2, < 3.0) websocket (~> 1.0) + sentry-rails (5.26.0) + railties (>= 5.0) + sentry-ruby (~> 5.26.0) + sentry-ruby (5.26.0) + bigdecimal + concurrent-ruby (~> 1.0, >= 1.0.2) sidekiq (7.3.9) base64 connection_pool (>= 2.3.0) @@ -489,6 +495,8 @@ DEPENDENCIES rails (~> 8.0.2) rubocop-rails-omakase selenium-webdriver + sentry-rails + sentry-ruby sidekiq sidekiq-scheduler slack-ruby-block-kit (>= 0.24.0) diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 4f1a513..e91ec44 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -16,6 +16,9 @@ <%# Includes all stylesheet files in app/assets/stylesheets %> <%= stylesheet_link_tag :app, "data-turbo-track": "reload" %> <%= javascript_importmap_tags %> + <% if Rails.env.production? %> + <%= Sentry.get_trace_propagation_meta.html_safe %> + <% end %> @@ -28,7 +31,7 @@ <% end %> <% end %> - + <%= yield %> diff --git a/config/initializers/sentry.rb b/config/initializers/sentry.rb new file mode 100644 index 0000000..0f4d7c3 --- /dev/null +++ b/config/initializers/sentry.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +if Rails.env.production? + Sentry.init do |config| + config.breadcrumbs_logger = [ :active_support_logger ] + config.dsn = ENV["SENTRY_DSN"] + config.traces_sample_rate = 1.0 + end +end