Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'lib/api/search.rb')
-rw-r--r--lib/api/search.rb25
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