Commit aa527966 authored by Ezekiel Kigbo's avatar Ezekiel Kigbo

Merge branch 'jnnkl-license-issue-body-telemetry' into 'master'

Add telemetry event for license compliance MR widget body Link

See merge request gitlab-org/gitlab!76917
parents c55c7142 798d105c
---
data_category: optional
key_path: redis_hll_counters.testing.users_clicking_license_testing_visiting_external_website_monthly
description: Count of users clicking licence to visit external information website
product_section: sec
product_stage: secure
product_group: group::static analysis
product_category: dependency_scanning
value_type: number
status: active
milestone: '14.7'
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/76917
time_frame: 28d
data_source: redis_hll
instrumentation_class: RedisHLLMetric
options:
events:
- users_clicking_license_testing_visiting_external_website
distribution:
- ce
- ee
tier:
- free
- premium
- ultimate
\ No newline at end of file
---
data_category: optional
key_path: redis_hll_counters.testing.users_clicking_license_testing_visiting_external_website_weekly
description: Count of users clicking licence to visit external information website
product_section: sec
product_stage: secure
product_group: group::static analysis
product_category: dependency_scanning
value_type: number
status: active
milestone: '14.7'
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/76917
time_frame: 7d
data_source: redis_hll
instrumentation_class: RedisHLLMetric
options:
events:
- users_clicking_license_testing_visiting_external_website
distribution:
- ce
- ee
tier:
- free
- premium
- ultimate
<script>
import { GlLink } from '@gitlab/ui';
import { mapActions } from 'vuex';
import api from '~/api';
import { LICENSE_MANAGEMENT } from 'ee/vue_shared/license_compliance/store/constants';
import { LICENSE_LINK_TELEMETRY_EVENT } from '../constants';
import LicensePackages from './license_packages.vue';
export default {
......@@ -19,13 +21,20 @@ export default {
return Boolean(this.issue.packages.length);
},
},
methods: { ...mapActions(LICENSE_MANAGEMENT, ['setLicenseInModal']) },
methods: {
...mapActions(LICENSE_MANAGEMENT, ['setLicenseInModal']),
trackLinkClick() {
api.trackRedisHllUserEvent(LICENSE_LINK_TELEMETRY_EVENT);
},
},
};
</script>
<template>
<div class="report-block-info license-item">
<gl-link v-if="issue.url" :href="issue.url" target="_blank">{{ issue.name }}</gl-link>
<gl-link v-if="issue.url" :href="issue.url" target="_blank" @click="trackLinkClick">{{
issue.name
}}</gl-link>
<span v-else data-testid="license-copy">{{ issue.name }}</span>
<license-packages v-if="hasPackages" :packages="issue.packages" class="text-secondary" />
</div>
......
......@@ -41,3 +41,6 @@ export const REPORT_GROUPS = [
status: STATUS_SUCCESS,
},
];
export const LICENSE_LINK_TELEMETRY_EVENT =
'users_clicking_license_testing_visiting_external_website';
import { GlLink } from '@gitlab/ui';
import { shallowMount } from '@vue/test-utils';
import { LICENSE_LINK_TELEMETRY_EVENT } from 'ee/vue_shared/license_compliance/constants';
import api from '~/api';
import LicenseIssueBody from 'ee/vue_shared/license_compliance/components/license_issue_body.vue';
import LicensePackages from 'ee/vue_shared/license_compliance/components/license_packages.vue';
import { extendedWrapper } from 'helpers/vue_test_utils_helper';
......@@ -79,4 +81,22 @@ describe('LicenseIssueBody', () => {
expect(packages.exists()).toBe(false);
});
});
describe('event tracking', () => {
let trackEventSpy;
beforeEach(() => {
trackEventSpy = jest.spyOn(api, 'trackRedisHllUserEvent').mockImplementation(() => {});
});
afterEach(() => {
trackEventSpy.mockRestore();
});
it('tracks users_visiting_testing_license_compliance_full_report', () => {
findGlLink().vm.$emit('click');
expect(trackEventSpy).toHaveBeenCalledWith(LICENSE_LINK_TELEMETRY_EVENT);
});
});
});
......@@ -368,6 +368,10 @@
redis_slot: testing
category: testing
aggregation: weekly
- name: users_clicking_license_testing_visiting_external_website
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