Browse Source

Add Sentry instrumentation (#593)

pull/619/head
Stéphane Meny 2 years ago committed by baarkerlounger
parent
commit
edac45fa74
  1. 2
      app/controllers/form_controller.rb
  2. 2
      config/initializers/sentry.rb

2
app/controllers/form_controller.rb

@ -4,6 +4,7 @@ class FormController < ApplicationController
before_action :find_resource_by_named_id, except: %i[submit_form review] before_action :find_resource_by_named_id, except: %i[submit_form review]
def submit_form def submit_form
transaction = Sentry.start_transaction(op: "submit_form")
if @case_log if @case_log
@page = @case_log.form.get_page(params[:case_log][:page]) @page = @case_log.form.get_page(params[:case_log][:page])
responses_for_page = responses_for_page(@page) responses_for_page = responses_for_page(@page)
@ -23,6 +24,7 @@ class FormController < ApplicationController
else else
render_not_found render_not_found
end end
transaction.finish
end end
def check_answers def check_answers

2
config/initializers/sentry.rb

@ -1,5 +1,5 @@
Sentry.init do |config| Sentry.init do |config|
config.breadcrumbs_logger = %i[active_support_logger http_logger] config.breadcrumbs_logger = %i[active_support_logger http_logger]
config.enabled_environments = %w[production staging] config.enabled_environments = %w[production staging]
config.traces_sample_rate = 0.5 config.traces_sample_rate = 1
end end

Loading…
Cancel
Save