summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Leitzen <pleitzen@gitlab.com>2019-09-12 11:12:30 +0000
committerPeter Leitzen <pleitzen@gitlab.com>2019-09-12 11:12:30 +0000
commit44dd3d2d6fea3a3fc9d8c6021227f59151e7dc4c (patch)
tree9bdf0a2f958e704edde148fb1bdfcb3d0e1f76d6
parentc2e46802626d44d383c1a4aec344d01602b9e9ea (diff)
parentff7c992ebd03b8f81525fa074e465badcae682f2 (diff)
downloadgitlab-ce-44dd3d2d6fea3a3fc9d8c6021227f59151e7dc4c.tar.gz
Merge branch 'track-usage-data-for-analytics-features' into 'master'12-3-auto-deploy-20190916
Setup counter for Productivity Analytics See merge request gitlab-org/gitlab-ce!32915
-rw-r--r--lib/gitlab/usage_data.rb1
-rw-r--r--lib/gitlab/usage_data_counters/productivity_analytics_counter.rb8
-rw-r--r--spec/lib/gitlab/usage_data_counters/productivity_analytics_counter_spec.rb9
-rw-r--r--spec/lib/gitlab/usage_data_spec.rb2
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