Commit d96a0e8e authored by Bob Van Landuyt's avatar Bob Van Landuyt

Merge branch '233919-add-instance-statistics-to-usage-ping' into 'master'

Add Instance Statistics to usage ping

Closes #233919

See merge request gitlab-org/gitlab!42211
parents fe2bfb45 0269e314
# frozen_string_literal: true
class Admin::InstanceStatisticsController < Admin::ApplicationController
include Analytics::UniqueVisitsHelper
before_action :check_feature_flag
track_unique_visits :index, target_id: 'i_analytics_instance_statistics'
def index
end
......
---
title: Add instance statistics visits to usage data
merge_request: 42211
author:
type: other
......@@ -25,7 +25,6 @@ RSpec.describe Admin::CredentialsController do
end
it_behaves_like 'tracking unique visits', :index do
let(:request_params) { {} }
let(:target_id) { 'i_compliance_credential_inventory' }
end
......
......@@ -77,6 +77,10 @@
category: analytics
redis_slot: analytics
aggregation: weekly
- name: i_analytics_instance_statistics
category: analytics
redis_slot: analytics
aggregation: weekly
- name: g_edit_by_web_ide
category: ide_edit
redis_slot: edit
......
......@@ -18,7 +18,6 @@ RSpec.describe Admin::CohortsController do
describe 'GET #index' do
it_behaves_like 'tracking unique visits', :index do
let(:request_params) { {} }
let(:target_id) { 'i_analytics_cohorts' }
end
end
......
......@@ -18,7 +18,6 @@ RSpec.describe Admin::DevOpsReportController do
end
it_behaves_like 'tracking unique visits', :show do
let(:request_params) { {} }
let(:target_id) { 'i_analytics_dev_ops_score' }
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
'p_analytics_repo' => 123,
'i_analytics_cohorts' => 123,
'i_analytics_dev_ops_score' => 123,
'i_analytics_instance_statistics' => 123,
'p_analytics_merge_request' => 123,
'g_analytics_merge_request' => 123,
'analytics_unique_visits_for_any_target' => 543,
......
# frozen_string_literal: true
RSpec.shared_examples 'tracking unique visits' do |method|
let(:request_params) { {} }
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)
......
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