diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-08-25 12:10:42 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-08-25 12:10:42 +0300 |
commit | e65c1d31c934772eb571e221482d88fb7d21ceea (patch) | |
tree | b0d605571654bb2e11a0bc65e2f33c3a08f22a4b /lib/gitlab | |
parent | 4ae91e9f5004d78168b5b50f9ce51db045e479d0 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/gitlab')
-rw-r--r-- | lib/gitlab/analytics/unique_visits.rb | 20 | ||||
-rw-r--r-- | lib/gitlab/usage_data.rb | 8 |
2 files changed, 14 insertions, 14 deletions
diff --git a/lib/gitlab/analytics/unique_visits.rb b/lib/gitlab/analytics/unique_visits.rb index ad746ebbd42..292048dcad9 100644 --- a/lib/gitlab/analytics/unique_visits.rb +++ b/lib/gitlab/analytics/unique_visits.rb @@ -14,23 +14,23 @@ module Gitlab # @param [ActiveSupport::TimeWithZone] end_date end of time frame # @return [Integer] number of unique visitors def unique_visits_for(targets:, start_date: 7.days.ago, end_date: start_date + 1.week) - target_ids = if targets == :analytics - self.class.analytics_ids - elsif targets == :compliance - self.class.compliance_ids - else - Array(targets) - end + events = if targets == :analytics + self.class.analytics_events + elsif targets == :compliance + self.class.compliance_events + else + Array(targets) + end - Gitlab::UsageDataCounters::HLLRedisCounter.unique_events(event_names: target_ids, start_date: start_date, end_date: end_date) + Gitlab::UsageDataCounters::HLLRedisCounter.unique_events(event_names: events, start_date: start_date, end_date: end_date) end class << self - def analytics_ids + def analytics_events Gitlab::UsageDataCounters::HLLRedisCounter.events_for_category('analytics') end - def compliance_ids + def compliance_events Gitlab::UsageDataCounters::HLLRedisCounter.events_for_category('compliance') end end diff --git a/lib/gitlab/usage_data.rb b/lib/gitlab/usage_data.rb index 7f3025ff983..1ba21d99277 100644 --- a/lib/gitlab/usage_data.rb +++ b/lib/gitlab/usage_data.rb @@ -589,8 +589,8 @@ module Gitlab end def analytics_unique_visits_data - results = ::Gitlab::Analytics::UniqueVisits.analytics_ids.each_with_object({}) do |target_id, hash| - hash[target_id] = redis_usage_data { unique_visit_service.unique_visits_for(targets: target_id) } + results = ::Gitlab::Analytics::UniqueVisits.analytics_events.each_with_object({}) do |target, hash| + hash[target] = redis_usage_data { unique_visit_service.unique_visits_for(targets: target) } end results['analytics_unique_visits_for_any_target'] = redis_usage_data { unique_visit_service.unique_visits_for(targets: :analytics) } results['analytics_unique_visits_for_any_target_monthly'] = redis_usage_data { unique_visit_service.unique_visits_for(targets: :analytics, start_date: 4.weeks.ago.to_date, end_date: Date.current) } @@ -599,8 +599,8 @@ module Gitlab end def compliance_unique_visits_data - results = ::Gitlab::Analytics::UniqueVisits.compliance_ids.each_with_object({}) do |target_id, hash| - hash[target_id] = redis_usage_data { unique_visit_service.unique_visits_for(targets: target_id) } + results = ::Gitlab::Analytics::UniqueVisits.compliance_events.each_with_object({}) do |target, hash| + hash[target] = redis_usage_data { unique_visit_service.unique_visits_for(targets: target) } end results['compliance_unique_visits_for_any_target'] = redis_usage_data { unique_visit_service.unique_visits_for(targets: :compliance) } results['compliance_unique_visits_for_any_target_monthly'] = redis_usage_data { unique_visit_service.unique_visits_for(targets: :compliance, start_date: 4.weeks.ago.to_date, end_date: Date.current) } |