summaryrefslogtreecommitdiff
path: root/app/controllers/admin/cohorts_controller.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers/admin/cohorts_controller.rb')
-rw-r--r--app/controllers/admin/cohorts_controller.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/app/controllers/admin/cohorts_controller.rb b/app/controllers/admin/cohorts_controller.rb
new file mode 100644
index 00000000000..e3df98b7917
--- /dev/null
+++ b/app/controllers/admin/cohorts_controller.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class Admin::CohortsController < Admin::ApplicationController
+ include Analytics::UniqueVisitsHelper
+
+ track_unique_visits :index, target_id: 'i_analytics_cohorts'
+
+ def index
+ if Gitlab::CurrentSettings.usage_ping_enabled
+ cohorts_results = Rails.cache.fetch('cohorts', expires_in: 1.day) do
+ CohortsService.new.execute
+ end
+
+ @cohorts = CohortsSerializer.new.represent(cohorts_results)
+ end
+ end
+end