Commit 0269e314 authored by Adam Hegyi's avatar Adam Hegyi

Add Instance Statistics to usage ping

parent 1d84b14b
# frozen_string_literal: true # frozen_string_literal: true
class Admin::InstanceStatisticsController < Admin::ApplicationController class Admin::InstanceStatisticsController < Admin::ApplicationController
include Analytics::UniqueVisitsHelper
before_action :check_feature_flag before_action :check_feature_flag
track_unique_visits :index, target_id: 'i_analytics_instance_statistics'
def index def index
end end
......
---
title: Add instance statistics visits to usage data
merge_request: 42211
author:
type: other
...@@ -21,7 +21,6 @@ RSpec.describe Admin::CredentialsController do ...@@ -21,7 +21,6 @@ RSpec.describe Admin::CredentialsController do
end end
it_behaves_like 'tracking unique visits', :index do it_behaves_like 'tracking unique visits', :index do
let(:request_params) { {} }
let(:target_id) { 'i_compliance_credential_inventory' } let(:target_id) { 'i_compliance_credential_inventory' }
end end
......
...@@ -77,6 +77,10 @@ ...@@ -77,6 +77,10 @@
category: analytics category: analytics
redis_slot: analytics redis_slot: analytics
aggregation: weekly aggregation: weekly
- name: i_analytics_instance_statistics
category: analytics
redis_slot: analytics
aggregation: weekly
- name: g_edit_by_web_ide - name: g_edit_by_web_ide
category: ide_edit category: ide_edit
redis_slot: edit redis_slot: edit
......
...@@ -18,7 +18,6 @@ RSpec.describe Admin::CohortsController do ...@@ -18,7 +18,6 @@ RSpec.describe Admin::CohortsController do
describe 'GET #index' do describe 'GET #index' do
it_behaves_like 'tracking unique visits', :index do it_behaves_like 'tracking unique visits', :index do
let(:request_params) { {} }
let(:target_id) { 'i_analytics_cohorts' } let(:target_id) { 'i_analytics_cohorts' }
end end
end end
......
...@@ -18,7 +18,6 @@ RSpec.describe Admin::DevOpsReportController do ...@@ -18,7 +18,6 @@ RSpec.describe Admin::DevOpsReportController do
end end
it_behaves_like 'tracking unique visits', :show do it_behaves_like 'tracking unique visits', :show do
let(:request_params) { {} }
let(:target_id) { 'i_analytics_dev_ops_score' } let(:target_id) { 'i_analytics_dev_ops_score' }
end end
end end
......
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe Admin::InstanceStatisticsController do
let(:admin) { create(:user, :admin) }
before do
sign_in(admin)
end
describe 'GET #show' do
it_behaves_like 'tracking unique visits', :index do
let(:target_id) { 'i_analytics_instance_statistics' }
end
end
end
...@@ -1064,6 +1064,7 @@ RSpec.describe Gitlab::UsageData, :aggregate_failures do ...@@ -1064,6 +1064,7 @@ RSpec.describe Gitlab::UsageData, :aggregate_failures do
'p_analytics_repo' => 123, 'p_analytics_repo' => 123,
'i_analytics_cohorts' => 123, 'i_analytics_cohorts' => 123,
'i_analytics_dev_ops_score' => 123, 'i_analytics_dev_ops_score' => 123,
'i_analytics_instance_statistics' => 123,
'p_analytics_merge_request' => 123, 'p_analytics_merge_request' => 123,
'g_analytics_merge_request' => 123, 'g_analytics_merge_request' => 123,
'analytics_unique_visits_for_any_target' => 543, 'analytics_unique_visits_for_any_target' => 543,
......
# frozen_string_literal: true # frozen_string_literal: true
RSpec.shared_examples 'tracking unique visits' do |method| RSpec.shared_examples 'tracking unique visits' do |method|
let(:request_params) { {} }
it 'tracks unique visit if the format is HTML' do it 'tracks unique visit if the format is HTML' do
expect_any_instance_of(Gitlab::Analytics::UniqueVisits).to receive(:track_visit).with(instance_of(String), target_id) expect_any_instance_of(Gitlab::Analytics::UniqueVisits).to receive(:track_visit).with(instance_of(String), target_id)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment