diff options
Diffstat (limited to 'app/controllers/search_controller.rb')
-rw-r--r-- | app/controllers/search_controller.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/app/controllers/search_controller.rb b/app/controllers/search_controller.rb index 5843e13c7cd..9f87ad6aaf6 100644 --- a/app/controllers/search_controller.rb +++ b/app/controllers/search_controller.rb @@ -57,7 +57,25 @@ class SearchController < ApplicationController @search_highlight = @search_service.search_highlight end + Gitlab::Metrics::GlobalSearchSlis.record_apdex( + elapsed: @global_search_duration_s, + search_type: @search_type, + search_level: @search_level, + search_scope: @scope + ) + increment_search_counters + ensure + if @search_type + # If we raise an error somewhere in the @global_search_duration_s benchmark block, we will end up here + # with a 200 status code, but an empty @global_search_duration_s. + Gitlab::Metrics::GlobalSearchSlis.record_error_rate( + error: @global_search_duration_s.nil? || (status < 200 || status >= 400), + search_type: @search_type, + search_level: @search_level, + search_scope: @scope + ) + end end def count |