Merge pull request #11118 from demarches-simplifiees/log_timeout_search
Tech: log les termes recherchés qui ont provoqué un timeout
This commit is contained in:
commit
f01df529c5
2 changed files with 18 additions and 1 deletions
app/controllers
|
@ -256,7 +256,7 @@ class ApplicationController < ActionController::Base
|
|||
user_id: current_user&.id,
|
||||
user_roles: current_user_roles,
|
||||
client_ip: request.headers['X-Forwarded-For'],
|
||||
request_id: request.headers['X-Request-ID']
|
||||
request_id: Current.request_id
|
||||
})
|
||||
|
||||
if browser.known?
|
||||
|
|
|
@ -71,6 +71,23 @@ class RechercheController < ApplicationController
|
|||
else
|
||||
return
|
||||
end
|
||||
|
||||
rescue ActiveRecord::QueryCanceled => e
|
||||
Sentry.capture_exception(e)
|
||||
|
||||
logger = Lograge.logger || Rails.logger
|
||||
|
||||
payload = {
|
||||
message: 'search timeout',
|
||||
user_id: current_user.id,
|
||||
request_id: Current.request_id,
|
||||
controller: self.class.name,
|
||||
terms: @search_terms
|
||||
}
|
||||
|
||||
logger.info(payload.to_json)
|
||||
|
||||
redirect_to recherche_index_path, alert: "La recherche n'a pas pu aboutir."
|
||||
end
|
||||
|
||||
private
|
||||
|
|
Loading…
Reference in a new issue