Commit 8df150af authored by mfluharty's avatar mfluharty

Track i_testing_full_code_quality_report_total

When full code quality report component is mounted
Increment the counter for unique users
Track at instance level so we can use it for PGMAU
parent 4e2a2eff
---
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'; ...@@ -4,6 +4,8 @@ import reportsMixin from 'ee/vue_shared/security_reports/mixins/reports_mixin';
import { componentNames } from 'ee/reports/components/issue_body'; import { componentNames } from 'ee/reports/components/issue_body';
import ReportSection from '~/reports/components/report_section.vue'; import ReportSection from '~/reports/components/report_section.vue';
import PaginationLinks from '~/vue_shared/components/pagination_links.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'; import { n__, s__, sprintf } from '~/locale';
export default { export default {
...@@ -11,7 +13,7 @@ export default { ...@@ -11,7 +13,7 @@ export default {
ReportSection, ReportSection,
PaginationLinks, PaginationLinks,
}, },
mixins: [reportsMixin], mixins: [reportsMixin, glFeatureFlagsMixin()],
componentNames, componentNames,
computed: { computed: {
...mapState(['isLoadingCodequality', 'loadingCodequalityFailed', 'pageInfo']), ...mapState(['isLoadingCodequality', 'loadingCodequalityFailed', 'pageInfo']),
...@@ -41,6 +43,11 @@ export default { ...@@ -41,6 +43,11 @@ export default {
return this.checkReportStatus(this.isLoadingCodequality, this.loadingCodequalityFailed); return this.checkReportStatus(this.isLoadingCodequality, this.loadingCodequalityFailed);
}, },
}, },
mounted() {
if (this.glFeatures.usageDataITestingFullCodeQualityReportTotal) {
api.trackRedisHllUserEvent(this.$options.mountEvent);
}
},
i18n: { i18n: {
subHeading: s__('ciReport|This report contains all Code Quality issues in the source branch.'), subHeading: s__('ciReport|This report contains all Code Quality issues in the source branch.'),
}, },
...@@ -57,6 +64,7 @@ export default { ...@@ -57,6 +64,7 @@ export default {
}; };
}, },
}, },
mountEvent: 'i_testing_full_code_quality_report_total',
}; };
</script> </script>
......
...@@ -8,6 +8,9 @@ module EE ...@@ -8,6 +8,9 @@ module EE
prepended do prepended do
before_action :authorize_read_licenses!, only: [:licenses] 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 end
def security 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'; ...@@ -2,7 +2,9 @@ import { mount, createLocalVue } from '@vue/test-utils';
import Vuex from 'vuex'; import Vuex from 'vuex';
import CodequalityReportApp from 'ee/codequality_report/codequality_report.vue'; import CodequalityReportApp from 'ee/codequality_report/codequality_report.vue';
import { parsedIssues } from './mock_data'; import { parsedIssues } from './mock_data';
import Api from '~/api';
jest.mock('~/api.js');
jest.mock('~/flash'); jest.mock('~/flash');
const localVue = createLocalVue(); const localVue = createLocalVue();
...@@ -12,7 +14,7 @@ describe('Codequality report app', () => { ...@@ -12,7 +14,7 @@ describe('Codequality report app', () => {
let wrapper; let wrapper;
let store; let store;
const createComponent = (state = {}, issues = []) => { const createComponent = (state = {}, issues = [], glFeatures = {}) => {
store = new Vuex.Store({ store = new Vuex.Store({
state: { state: {
pageInfo: {}, pageInfo: {},
...@@ -27,6 +29,9 @@ describe('Codequality report app', () => { ...@@ -27,6 +29,9 @@ describe('Codequality report app', () => {
wrapper = mount(CodequalityReportApp, { wrapper = mount(CodequalityReportApp, {
localVue, localVue,
store, store,
provide: {
glFeatures,
},
}); });
}; };
...@@ -96,4 +101,22 @@ describe('Codequality report app', () => { ...@@ -96,4 +101,22 @@ describe('Codequality report app', () => {
expect(wrapper.findAll('.report-block-list-issue')).toHaveLength(0); 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 @@ ...@@ -258,6 +258,11 @@
redis_slot: testing redis_slot: testing
aggregation: weekly aggregation: weekly
feature_flag: usage_data_i_testing_group_code_coverage_visit_total 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 # Project Management group
- name: g_project_management_issue_title_changed - name: g_project_management_issue_title_changed
category: issues_edit 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