diff --git a/Gemfile b/Gemfile index 076d306393..4692ae0461 100644 --- a/Gemfile +++ b/Gemfile @@ -40,6 +40,7 @@ gem 'jsonb_accessor' gem 'sentry-rails' gem 'sentry-ruby' gem 'sentry-sidekiq' +gem 'stackprof' # Windows does not include zoneinfo files, so bundle the tzinfo-data gem gem 'tzinfo-data', platforms: %i[mingw mswin x64_mingw jruby] diff --git a/Gemfile.lock b/Gemfile.lock index 9e83ed0329..707d220bcc 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -691,6 +691,7 @@ GEM skylight (6.0.4) activesupport (>= 5.2.0) smart_properties (1.17.0) + stackprof (0.2.26) stringio (3.1.2) super_diff (0.14.0) attr_extras (>= 6.2.4) @@ -842,6 +843,7 @@ DEPENDENCIES simplecov (< 0.23) site_prism (~> 5.0) skylight + stackprof super_diff table_print terminal-table diff --git a/app/controllers/find/results_controller.rb b/app/controllers/find/results_controller.rb index 620cf3a638..509561e3bc 100644 --- a/app/controllers/find/results_controller.rb +++ b/app/controllers/find/results_controller.rb @@ -2,6 +2,7 @@ module Find class ResultsController < ApplicationController + before_action :set_sentry_context before_action :render_feedback_component def index @@ -23,5 +24,12 @@ def index def track_search_results(number_of_results:, course_codes:) Find::ResultsTracking.new(request:).track_search_results(number_of_results:, course_codes:) end + + def set_sentry_context + Sentry.set_context('Request Headers', { + Referer: request.headers['Referer'] + }) + Sentry.set_context('Query Parameters', request.query_parameters) + end end end