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>
import { GlLink, GlIcon, GlButton } from '@gitlab/ui';
import { mapState, mapGetters, mapActions } from 'vuex';
import api from '~/api';
import { componentNames, iconComponentNames } from 'ee/reports/components/issue_body';
import { LICENSE_MANAGEMENT } from 'ee/vue_shared/license_compliance/store/constants';
import reportsMixin from 'ee/vue_shared/security_reports/mixins/reports_mixin';
......@@ -111,6 +112,9 @@ export default {
this.fetchLicenseCheckApprovalRule();
},
methods: {
trackVisitedPath(trackAction) {
api.trackRedisHllUserEvent(trackAction);
},
...mapActions(LICENSE_MANAGEMENT, [
'setAPISettings',
'fetchParsedLicenseReport',
......@@ -129,6 +133,7 @@ export default {
:has-issues="hasLicenseReportIssues"
:component="$options.componentNames.LicenseIssueBody"
:class="reportSectionClass"
track-action="users_expanding_testing_license_compliance_report"
:always-open="alwaysOpen"
class="license-report-widget mr-report"
data-qa-selector="license_report_widget"
......@@ -184,10 +189,11 @@ export default {
<gl-button
v-if="fullReportPath"
:href="fullReportPath"
target="_blank"
data-testid="full-report-button"
class="gl-mr-3"
icon="external-link"
target="_blank"
data-testid="full-report-button"
@click="trackVisitedPath('users_visiting_testing_license_compliance_full_report')"
>
{{ s__('ciReport|View full report') }}
</gl-button>
......@@ -197,6 +203,7 @@ export default {
:class="{ 'gl-mr-3': isCollapsible }"
:href="licenseManagementSettingsPath"
data-qa-selector="manage_licenses_button"
@click="trackVisitedPath('users_visiting_testing_manage_license_compliance')"
>
{{ s__('ciReport|Manage licenses') }}
</gl-button>
......
import { shallowMount } from '@vue/test-utils';
import Vue from 'vue';
import Vuex from 'vuex';
import api from '~/api';
import LicenseManagement from 'ee/vue_shared/license_compliance/mr_widget_license_report.vue';
import { stubComponent } from 'helpers/stub_component';
import { TEST_HOST } from 'spec/test_constants';
......@@ -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', () => {
it('should be `LOADING`, if the report is loading', () => {
const getters = {
......
......@@ -355,6 +355,19 @@
category: testing
aggregation: weekly
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
- name: clusters_using_network_policies_ui
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