2019-10-12 21:52:04 +05:30
|
|
|
# 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
|
2020-05-24 23:13:21 +05:30
|
|
|
|
|
|
|
def fallback_totals
|
|
|
|
{ navbar_searches: -1 }
|
|
|
|
end
|
2019-10-12 21:52:04 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|