diff options
author | Francisco Javier López <fjlopez@gitlab.com> | 2019-07-29 12:58:58 +0300 |
---|---|---|
committer | Paul Slaughter <pslaughter@gitlab.com> | 2019-07-29 12:58:58 +0300 |
commit | 26e9efc011c49b6918d4cc345a3328cabf22e2a7 (patch) | |
tree | 15076bcd7636cc4efc1421853245196a12fc2bdc /lib/gitlab/usage_data_counters | |
parent | 77926ea02512d836c61a30e3986902e2d8e7f886 (diff) |
Added navbar searches usage ping counter
Added usage ping counter when the user makes
a search through the navbar search component.
Diffstat (limited to 'lib/gitlab/usage_data_counters')
-rw-r--r-- | lib/gitlab/usage_data_counters/search_counter.rb | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/lib/gitlab/usage_data_counters/search_counter.rb b/lib/gitlab/usage_data_counters/search_counter.rb new file mode 100644 index 00000000000..5f0735347e1 --- /dev/null +++ b/lib/gitlab/usage_data_counters/search_counter.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +module Gitlab + module UsageDataCounters + class SearchCounter + extend RedisCounter + + NAVBAR_SEARCHES_COUNT_KEY = 'NAVBAR_SEARCHES_COUNT' + + class << self + def increment_navbar_searches_count + increment(NAVBAR_SEARCHES_COUNT_KEY) + end + + def total_navbar_searches_count + total_count(NAVBAR_SEARCHES_COUNT_KEY) + end + + def totals + { + navbar_searches: total_navbar_searches_count + } + end + end + end + end +end |