Commit 0d45b816 authored by Scott Hampton's avatar Scott Hampton

Add usage ping for repo analytics page

Usage ping for every user that views the repo
analytics page.
parent 326cc0ca
---
name: usage_data_i_testing_group_code_coverage_visit_total
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/51382
rollout_issue_url:
milestone: '13.8'
type: development
group: group::testing
default_enabled: true
# frozen_string_literal: true
class Groups::Analytics::RepositoryAnalyticsController < Groups::Analytics::ApplicationController
include RedisTracking
layout 'group'
before_action :load_group
before_action -> { check_feature_availability!(:group_repository_analytics) }
before_action -> { authorize_view_by_action!(:read_group_repository_analytics) }
track_redis_hll_event :show, name: 'i_testing_group_code_coverage_visit_total', feature: :usage_data_i_testing_group_code_coverage_visit_total, feature_default_enabled: true
def show
track_event(**pageview_tracker_params)
......
---
title: Capture unique user views of group repository analytics page
merge_request: 51382
author:
type: added
......@@ -33,6 +33,19 @@ RSpec.describe Groups::Analytics::RepositoryAnalyticsController do
)
end
context 'unique users tracking' do
before do
allow(Gitlab::UsageDataCounters::HLLRedisCounter).to receive(:track_event)
end
it_behaves_like 'tracking unique hll events', :usage_data_i_testing_group_code_coverage_visit_total do
subject(:request) { get :show, params: { group_id: group } }
let(:target_id) { 'i_testing_group_code_coverage_visit_total' }
let(:expected_type) { instance_of(String) }
end
end
context 'when license is missing' do
before do
stub_licensed_features(feature_name => false)
......
......@@ -253,6 +253,11 @@
redis_slot: testing
aggregation: weekly
feature_flag: usage_data_i_testing_metrics_report_widget_total
- name: i_testing_group_code_coverage_visit_total
category: testing
redis_slot: testing
aggregation: weekly
feature_flag: usage_data_i_testing_group_code_coverage_visit_total
# Project Management group
- name: g_project_management_issue_title_changed
category: issues_edit
......
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