Commit 313b3037 authored by Andrew Fontaine's avatar Andrew Fontaine

Merge branch '276380-track-full-code-quality-report-views' into 'master'

Track usage ping event when the full code quality report component is mounted

See merge request gitlab-org/gitlab!49079
parents 6e7646f5 8df150af
---
name: usage_data_i_testing_full_code_quality_report_total
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/49079
rollout_issue_url:
milestone: '13.8'
type: development
group: group::testing
default_enabled: true
......@@ -4,6 +4,8 @@ import reportsMixin from 'ee/vue_shared/security_reports/mixins/reports_mixin';
import { componentNames } from 'ee/reports/components/issue_body';
import ReportSection from '~/reports/components/report_section.vue';
import PaginationLinks from '~/vue_shared/components/pagination_links.vue';
import api from '~/api';
import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
import { n__, s__, sprintf } from '~/locale';
export default {
......@@ -11,7 +13,7 @@ export default {
ReportSection,
PaginationLinks,
},
mixins: [reportsMixin],
mixins: [reportsMixin, glFeatureFlagsMixin()],
componentNames,
computed: {
...mapState(['isLoadingCodequality', 'loadingCodequalityFailed', 'pageInfo']),
......@@ -41,6 +43,11 @@ export default {
return this.checkReportStatus(this.isLoadingCodequality, this.loadingCodequalityFailed);
},
},
mounted() {
if (this.glFeatures.usageDataITestingFullCodeQualityReportTotal) {
api.trackRedisHllUserEvent(this.$options.mountEvent);
}
},
i18n: {
subHeading: s__('ciReport|This report contains all Code Quality issues in the source branch.'),
},
......@@ -57,6 +64,7 @@ export default {
};
},
},
mountEvent: 'i_testing_full_code_quality_report_total',
};
</script>
......
......@@ -8,6 +8,9 @@ module EE
prepended do
before_action :authorize_read_licenses!, only: [:licenses]
before_action do
push_frontend_feature_flag(:usage_data_i_testing_full_code_quality_report_total, project, default_enabled: true)
end
end
def security
......
---
title: Track full code quality report views via usage ping
merge_request: 49079
author:
type: added
......@@ -2,7 +2,9 @@ import { mount, createLocalVue } from '@vue/test-utils';
import Vuex from 'vuex';
import CodequalityReportApp from 'ee/codequality_report/codequality_report.vue';
import { parsedIssues } from './mock_data';
import Api from '~/api';
jest.mock('~/api.js');
jest.mock('~/flash');
const localVue = createLocalVue();
......@@ -12,7 +14,7 @@ describe('Codequality report app', () => {
let wrapper;
let store;
const createComponent = (state = {}, issues = []) => {
const createComponent = (state = {}, issues = [], glFeatures = {}) => {
store = new Vuex.Store({
state: {
pageInfo: {},
......@@ -27,6 +29,9 @@ describe('Codequality report app', () => {
wrapper = mount(CodequalityReportApp, {
localVue,
store,
provide: {
glFeatures,
},
});
};
......@@ -96,4 +101,22 @@ describe('Codequality report app', () => {
expect(wrapper.findAll('.report-block-list-issue')).toHaveLength(0);
});
});
describe('usage ping tracking', () => {
describe('with feature flag enabled', () => {
it('tracks an event when mounted', () => {
createComponent({}, [], { usageDataITestingFullCodeQualityReportTotal: true });
expect(Api.trackRedisHllUserEvent).toHaveBeenCalledWith(wrapper.vm.$options.mountEvent);
});
});
describe('with feature flag disabled', () => {
it('does not track an event when mounted', () => {
createComponent({}, [], { usageDataIFullCodeQualityReportTotal: false });
expect(Api.trackRedisHllUserEvent).not.toHaveBeenCalled();
});
});
});
});
......@@ -258,6 +258,11 @@
redis_slot: testing
aggregation: weekly
feature_flag: usage_data_i_testing_group_code_coverage_visit_total
- name: i_testing_full_code_quality_report_total
category: testing
redis_slot: testing
aggregation: weekly
feature_flag: usage_data_i_testing_full_code_quality_report_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