diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-08-03 21:11:59 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-08-03 21:11:59 +0300 |
commit | b9b477a3f1e64590e087cfe2cc21c9d5bd448756 (patch) | |
tree | b42659fe7d1f05c4965994929a91b386ff827ff0 /lib/gitlab/instrumentation | |
parent | 849c67f6da8d997d9fa54bba3526c64c7678aae6 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/gitlab/instrumentation')
-rw-r--r-- | lib/gitlab/instrumentation/global_search_api.rb | 39 |
1 files changed, 23 insertions, 16 deletions
diff --git a/lib/gitlab/instrumentation/global_search_api.rb b/lib/gitlab/instrumentation/global_search_api.rb index 478de4cc798..ea2f5702364 100644 --- a/lib/gitlab/instrumentation/global_search_api.rb +++ b/lib/gitlab/instrumentation/global_search_api.rb @@ -3,35 +3,42 @@ module Gitlab module Instrumentation class GlobalSearchApi - GLOBAL_SEARCH_TYPE = 'meta.search.type' - GLOBAL_SEARCH_LEVEL = 'meta.search.level' - GLOBAL_SEARCH_DURATION_S = :global_search_duration_s + TYPE = 'meta.search.type' + LEVEL = 'meta.search.level' + SCOPE = 'meta.search.scope' + SEARCH_DURATION_S = :global_search_duration_s - def self.get_global_search_type - ::Gitlab::SafeRequestStore[GLOBAL_SEARCH_TYPE] + def self.get_type + ::Gitlab::SafeRequestStore[TYPE] end - def self.get_global_search_level - ::Gitlab::SafeRequestStore[GLOBAL_SEARCH_LEVEL] + def self.get_level + ::Gitlab::SafeRequestStore[LEVEL] end - def self.get_global_search_duration_s - ::Gitlab::SafeRequestStore[GLOBAL_SEARCH_DURATION_S] + def self.get_scope + ::Gitlab::SafeRequestStore[SCOPE] + end + + def self.get_search_duration_s + ::Gitlab::SafeRequestStore[SEARCH_DURATION_S] end def self.payload { - GLOBAL_SEARCH_TYPE => get_global_search_type, - GLOBAL_SEARCH_LEVEL => get_global_search_level, - GLOBAL_SEARCH_DURATION_S => get_global_search_duration_s + TYPE => get_type, + LEVEL => get_level, + SCOPE => get_scope, + SEARCH_DURATION_S => get_search_duration_s }.compact end - def self.set_global_search_information(global_search_type:, global_search_level:, global_search_duration_s:) + def self.set_information(type:, level:, scope:, search_duration_s:) if ::Gitlab::SafeRequestStore.active? - ::Gitlab::SafeRequestStore[GLOBAL_SEARCH_TYPE] = global_search_type - ::Gitlab::SafeRequestStore[GLOBAL_SEARCH_LEVEL] = global_search_level - ::Gitlab::SafeRequestStore[GLOBAL_SEARCH_DURATION_S] = global_search_duration_s + ::Gitlab::SafeRequestStore[TYPE] = type + ::Gitlab::SafeRequestStore[LEVEL] = level + ::Gitlab::SafeRequestStore[SCOPE] = scope + ::Gitlab::SafeRequestStore[SEARCH_DURATION_S] = search_duration_s end end end |