diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-08-18 11:17:02 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-08-18 11:17:02 +0300 |
commit | b39512ed755239198a9c294b6a45e65c05900235 (patch) | |
tree | d234a3efade1de67c46b9e5a38ce813627726aa7 /lib/api/search.rb | |
parent | d31474cf3b17ece37939d20082b07f6657cc79a9 (diff) |
Add latest changes from gitlab-org/gitlab@15-3-stable-eev15.3.0-rc42
Diffstat (limited to 'lib/api/search.rb')
-rw-r--r-- | lib/api/search.rb | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/lib/api/search.rb b/lib/api/search.rb index fd4d46cf77d..c78aff705ab 100644 --- a/lib/api/search.rb +++ b/lib/api/search.rb @@ -59,11 +59,15 @@ module API end def search(additional_params = {}) - results = search_service(additional_params).search_objects(preload_method) + @search_duration_s = Benchmark.realtime do + @results = search_service(additional_params).search_objects(preload_method) + end + + set_global_search_log_information Gitlab::UsageDataCounters::SearchCounter.count(:all_searches) - paginate(results) + paginate(@results) end def snippets? @@ -83,6 +87,23 @@ module API # Defining this method here as a noop allows us to easily extend it in # EE, without having to modify this file directly. end + + def search_type + 'basic' + end + + def search_scope + params[:scope] + end + + def set_global_search_log_information + Gitlab::Instrumentation::GlobalSearchApi.set_information( + type: search_type, + level: search_service.level, + scope: search_scope, + search_duration_s: @search_duration_s + ) + end end resource :search do |