diff options
author | Adam Hegyi <ahegyi@gitlab.com> | 2019-09-12 11:12:29 +0000 |
---|---|---|
committer | Peter Leitzen <pleitzen@gitlab.com> | 2019-09-12 11:12:29 +0000 |
commit | ff7c992ebd03b8f81525fa074e465badcae682f2 (patch) | |
tree | 9bdf0a2f958e704edde148fb1bdfcb3d0e1f76d6 | |
parent | c2e46802626d44d383c1a4aec344d01602b9e9ea (diff) | |
download | gitlab-ce-ff7c992ebd03b8f81525fa074e465badcae682f2.tar.gz |
Setup counter for Productivity Analytics
This change sets up a usage counter for productivity analytics feature.
4 files changed, 20 insertions, 0 deletions
diff --git a/lib/gitlab/usage_data.rb b/lib/gitlab/usage_data.rb index a93301cb4ce..fb18c7a8554 100644 --- a/lib/gitlab/usage_data.rb +++ b/lib/gitlab/usage_data.rb @@ -142,6 +142,7 @@ module Gitlab Gitlab::UsageDataCounters::SnippetCounter, Gitlab::UsageDataCounters::SearchCounter, Gitlab::UsageDataCounters::CycleAnalyticsCounter, + Gitlab::UsageDataCounters::ProductivityAnalyticsCounter, Gitlab::UsageDataCounters::SourceCodeCounter, Gitlab::UsageDataCounters::MergeRequestCounter ] diff --git a/lib/gitlab/usage_data_counters/productivity_analytics_counter.rb b/lib/gitlab/usage_data_counters/productivity_analytics_counter.rb new file mode 100644 index 00000000000..3b92fa01fbe --- /dev/null +++ b/lib/gitlab/usage_data_counters/productivity_analytics_counter.rb @@ -0,0 +1,8 @@ +# frozen_string_literal: true + +module Gitlab::UsageDataCounters + class ProductivityAnalyticsCounter < BaseCounter + KNOWN_EVENTS = %w[views].freeze + PREFIX = 'productivity_analytics' + end +end diff --git a/spec/lib/gitlab/usage_data_counters/productivity_analytics_counter_spec.rb b/spec/lib/gitlab/usage_data_counters/productivity_analytics_counter_spec.rb new file mode 100644 index 00000000000..f4e92791728 --- /dev/null +++ b/spec/lib/gitlab/usage_data_counters/productivity_analytics_counter_spec.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +require 'spec_helper' + +describe Gitlab::UsageDataCounters::ProductivityAnalyticsCounter do + it_behaves_like 'a redis usage counter', 'ProductivityAnalytics', :views + + it_behaves_like 'a redis usage counter with totals', :productivity_analytics, views: 3 +end diff --git a/spec/lib/gitlab/usage_data_spec.rb b/spec/lib/gitlab/usage_data_spec.rb index b3a179e276b..8eb64b97d6a 100644 --- a/spec/lib/gitlab/usage_data_spec.rb +++ b/spec/lib/gitlab/usage_data_spec.rb @@ -62,6 +62,7 @@ describe Gitlab::UsageData do influxdb_metrics_enabled prometheus_metrics_enabled cycle_analytics_views + productivity_analytics_views )) expect(subject).to include( @@ -79,6 +80,7 @@ describe Gitlab::UsageData do web_ide_merge_requests: a_kind_of(Integer), navbar_searches: a_kind_of(Integer), cycle_analytics_views: a_kind_of(Integer), + productivity_analytics_views: a_kind_of(Integer), source_code_pushes: a_kind_of(Integer) ) end |