Commit e4880503 authored by Vitaly Slobodin's avatar Vitaly Slobodin

Merge branch 'jnnkl-license-compliance-mr-widget-tracking' into 'master'

Add License Compliance MR Widget Tracking events

See merge request gitlab-org/gitlab!75643
parents d235a6eb 800816c2
---
data_category: optional
key_path: redis_hll_counters.testing.users_expanding_testing_license_compliance_report_monthly
description: Count of expanding the license compliance widget
product_section: sec
product_stage: secure
product_group: group::static analysis
product_category: dependency_scanning
value_type: number
status: active
milestone: '14.6'
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/75643
time_frame: 28d
data_source: redis_hll
instrumentation_class: RedisHLLMetric
options:
events:
- users_expanding_testing_license_compliance_report
distribution:
- ce
- ee
tier:
- free
- premium
- ultimate
---
data_category: optional
key_path: redis_hll_counters.testing.users_visiting_testing_license_compliance_full_report_monthly
description: Count of visiting the license compliance full report
product_section: sec
product_stage: secure
product_group: group::static analysis
product_category: dependency_scanning
value_type: number
status: active
milestone: '14.6'
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/75643
time_frame: 28d
data_source: redis_hll
instrumentation_class: RedisHLLMetric
options:
events:
- users_visiting_testing_license_compliance_full_report
distribution:
- ce
- ee
tier:
- free
- premium
- ultimate
---
data_category: optional
key_path: redis_hll_counters.testing.users_visiting_testing_manage_license_compliance_monthly
description: Count of visiting the manage license compliance page
product_section: sec
product_stage: secure
product_group: group::static analysis
product_category: dependency_scanning
value_type: number
status: active
milestone: '14.6'
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/75643
time_frame: 28d
data_source: redis_hll
instrumentation_class: RedisHLLMetric
options:
events:
- users_visiting_testing_manage_license_compliance
distribution:
- ce
- ee
tier:
- free
- premium
- ultimate
---
data_category: optional
key_path: redis_hll_counters.testing.users_expanding_testing_license_compliance_report_weekly
description: Count of expanding the license compliance widget
product_section: sec
product_stage: secure
product_group: group::static analysis
product_category: dependency_scanning
value_type: number
status: active
milestone: '14.6'
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/75643
time_frame: 7d
data_source: redis_hll
instrumentation_class: RedisHLLMetric
options:
events:
- users_expanding_testing_license_compliance_report
distribution:
- ce
- ee
tier:
- free
- premium
- ultimate
---
data_category: optional
key_path: redis_hll_counters.testing.users_visiting_testing_license_compliance_full_report_weekly
description: Count of visiting the license compliance full report
product_section: sec
product_stage: secure
product_group: group::static analysis
product_category: dependency_scanning
value_type: number
status: active
milestone: '14.6'
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/75643
time_frame: 7d
data_source: redis_hll
instrumentation_class: RedisHLLMetric
options:
events:
- users_visiting_testing_license_compliance_full_report
distribution:
- ce
- ee
tier:
- free
- premium
- ultimate
---
data_category: optional
key_path: redis_hll_counters.testing.users_visiting_testing_manage_license_compliance_weekly
description: Count of visiting the manage license compliance page
product_section: sec
product_stage: secure
product_group: group::static analysis
product_category: dependency_scanning
value_type: number
status: active
milestone: '14.6'
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/75643
time_frame: 7d
data_source: redis_hll
instrumentation_class: RedisHLLMetric
options:
events:
- users_visiting_testing_manage_license_compliance
distribution:
- ce
- ee
tier:
- free
- premium
- ultimate
<script> <script>
import { GlLink, GlIcon, GlButton } from '@gitlab/ui'; import { GlLink, GlIcon, GlButton } from '@gitlab/ui';
import { mapState, mapGetters, mapActions } from 'vuex'; import { mapState, mapGetters, mapActions } from 'vuex';
import api from '~/api';
import { componentNames, iconComponentNames } from 'ee/reports/components/issue_body'; import { componentNames, iconComponentNames } from 'ee/reports/components/issue_body';
import { LICENSE_MANAGEMENT } from 'ee/vue_shared/license_compliance/store/constants'; import { LICENSE_MANAGEMENT } from 'ee/vue_shared/license_compliance/store/constants';
import reportsMixin from 'ee/vue_shared/security_reports/mixins/reports_mixin'; import reportsMixin from 'ee/vue_shared/security_reports/mixins/reports_mixin';
...@@ -111,6 +112,9 @@ export default { ...@@ -111,6 +112,9 @@ export default {
this.fetchLicenseCheckApprovalRule(); this.fetchLicenseCheckApprovalRule();
}, },
methods: { methods: {
trackVisitedPath(trackAction) {
api.trackRedisHllUserEvent(trackAction);
},
...mapActions(LICENSE_MANAGEMENT, [ ...mapActions(LICENSE_MANAGEMENT, [
'setAPISettings', 'setAPISettings',
'fetchParsedLicenseReport', 'fetchParsedLicenseReport',
...@@ -129,6 +133,7 @@ export default { ...@@ -129,6 +133,7 @@ export default {
:has-issues="hasLicenseReportIssues" :has-issues="hasLicenseReportIssues"
:component="$options.componentNames.LicenseIssueBody" :component="$options.componentNames.LicenseIssueBody"
:class="reportSectionClass" :class="reportSectionClass"
track-action="users_expanding_testing_license_compliance_report"
:always-open="alwaysOpen" :always-open="alwaysOpen"
class="license-report-widget mr-report" class="license-report-widget mr-report"
data-qa-selector="license_report_widget" data-qa-selector="license_report_widget"
...@@ -184,10 +189,11 @@ export default { ...@@ -184,10 +189,11 @@ export default {
<gl-button <gl-button
v-if="fullReportPath" v-if="fullReportPath"
:href="fullReportPath" :href="fullReportPath"
target="_blank"
data-testid="full-report-button"
class="gl-mr-3" class="gl-mr-3"
icon="external-link" icon="external-link"
target="_blank"
data-testid="full-report-button"
@click="trackVisitedPath('users_visiting_testing_license_compliance_full_report')"
> >
{{ s__('ciReport|View full report') }} {{ s__('ciReport|View full report') }}
</gl-button> </gl-button>
...@@ -197,6 +203,7 @@ export default { ...@@ -197,6 +203,7 @@ export default {
:class="{ 'gl-mr-3': isCollapsible }" :class="{ 'gl-mr-3': isCollapsible }"
:href="licenseManagementSettingsPath" :href="licenseManagementSettingsPath"
data-qa-selector="manage_licenses_button" data-qa-selector="manage_licenses_button"
@click="trackVisitedPath('users_visiting_testing_manage_license_compliance')"
> >
{{ s__('ciReport|Manage licenses') }} {{ s__('ciReport|Manage licenses') }}
</gl-button> </gl-button>
......
import { shallowMount } from '@vue/test-utils'; import { shallowMount } from '@vue/test-utils';
import Vue from 'vue'; import Vue from 'vue';
import Vuex from 'vuex'; import Vuex from 'vuex';
import api from '~/api';
import LicenseManagement from 'ee/vue_shared/license_compliance/mr_widget_license_report.vue'; import LicenseManagement from 'ee/vue_shared/license_compliance/mr_widget_license_report.vue';
import { stubComponent } from 'helpers/stub_component'; import { stubComponent } from 'helpers/stub_component';
import { TEST_HOST } from 'spec/test_constants'; import { TEST_HOST } from 'spec/test_constants';
...@@ -116,6 +117,36 @@ describe('License Report MR Widget', () => { ...@@ -116,6 +117,36 @@ describe('License Report MR Widget', () => {
}); });
}); });
describe('snowplow', () => {
let trackEventSpy;
beforeEach(() => {
mountComponent();
trackEventSpy = jest.spyOn(api, 'trackRedisHllUserEvent').mockImplementation(() => {});
});
afterEach(() => {
trackEventSpy.mockRestore();
});
it('tracks users_visiting_testing_license_compliance_full_report', () => {
wrapper.find('[data-testid="full-report-button"]').vm.$emit('click');
expect(trackEventSpy).toHaveBeenCalledWith(
'users_visiting_testing_license_compliance_full_report',
);
});
it('tracks users_visiting_testing_manage_license_compliance', () => {
wrapper.find('[data-testid="manage-licenses-button"]').vm.$emit('click');
expect(trackEventSpy).toHaveBeenCalledWith(
'users_visiting_testing_manage_license_compliance',
);
});
});
describe('licenseReportStatus', () => { describe('licenseReportStatus', () => {
it('should be `LOADING`, if the report is loading', () => { it('should be `LOADING`, if the report is loading', () => {
const getters = { const getters = {
......
...@@ -355,6 +355,19 @@ ...@@ -355,6 +355,19 @@
category: testing category: testing
aggregation: weekly aggregation: weekly
feature_flag: users_expanding_widgets_usage_data feature_flag: users_expanding_widgets_usage_data
- name: users_expanding_testing_license_compliance_report
redis_slot: testing
category: testing
aggregation: weekly
feature_flag: users_expanding_widgets_usage_data
- name: users_visiting_testing_license_compliance_full_report
redis_slot: testing
category: testing
aggregation: weekly
- name: users_visiting_testing_manage_license_compliance
redis_slot: testing
category: testing
aggregation: weekly
# Container Security - Network Policies # Container Security - Network Policies
- name: clusters_using_network_policies_ui - name: clusters_using_network_policies_ui
redis_slot: network_policies redis_slot: network_policies
......
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