Commit 26f3da5a authored by Axel Garcia's avatar Axel Garcia Committed by Luke Duncalfe

Follow-up pass for renaming Usage Ping/Data

MR: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/66990

Changelog: other
parent 35eaf35c
...@@ -1658,7 +1658,7 @@ Gitlab/NamespacedClass: ...@@ -1658,7 +1658,7 @@ Gitlab/NamespacedClass:
- 'app/services/reset_project_cache_service.rb' - 'app/services/reset_project_cache_service.rb'
- 'app/services/search_service.rb' - 'app/services/search_service.rb'
- 'app/services/service_response.rb' - 'app/services/service_response.rb'
- 'app/services/submit_usage_ping_service.rb' - 'app/services/service_ping/submit_service.rb'
- 'app/services/system_hooks_service.rb' - 'app/services/system_hooks_service.rb'
- 'app/services/task_list_toggle_service.rb' - 'app/services/task_list_toggle_service.rb'
- 'app/services/todo_service.rb' - 'app/services/todo_service.rb'
......
...@@ -8,34 +8,34 @@ export const HELPER_TEXT_SERVICE_PING_ENABLED = __( ...@@ -8,34 +8,34 @@ export const HELPER_TEXT_SERVICE_PING_ENABLED = __(
'You can enable Registration Features because Service Ping is enabled. To continue using Registration Features in the future, you will also need to register with GitLab via a new cloud licensing service.', 'You can enable Registration Features because Service Ping is enabled. To continue using Registration Features in the future, you will also need to register with GitLab via a new cloud licensing service.',
); );
function setHelperText(usagePingCheckbox) { function setHelperText(servicePingCheckbox) {
const helperTextId = document.getElementById('service_ping_features_helper_text'); const helperTextId = document.getElementById('service_ping_features_helper_text');
const usagePingFeaturesLabel = document.getElementById('service_ping_features_label'); const servicePingFeaturesLabel = document.getElementById('service_ping_features_label');
const usagePingFeaturesCheckbox = document.getElementById( const servicePingFeaturesCheckbox = document.getElementById(
'application_setting_usage_ping_features_enabled', 'application_setting_usage_ping_features_enabled',
); );
helperTextId.textContent = usagePingCheckbox.checked helperTextId.textContent = servicePingCheckbox.checked
? HELPER_TEXT_SERVICE_PING_ENABLED ? HELPER_TEXT_SERVICE_PING_ENABLED
: HELPER_TEXT_SERVICE_PING_DISABLED; : HELPER_TEXT_SERVICE_PING_DISABLED;
usagePingFeaturesLabel.classList.toggle('gl-cursor-not-allowed', !usagePingCheckbox.checked); servicePingFeaturesLabel.classList.toggle('gl-cursor-not-allowed', !servicePingCheckbox.checked);
usagePingFeaturesCheckbox.disabled = !usagePingCheckbox.checked; servicePingFeaturesCheckbox.disabled = !servicePingCheckbox.checked;
if (!usagePingCheckbox.checked) { if (!servicePingCheckbox.checked) {
usagePingFeaturesCheckbox.disabled = true; servicePingFeaturesCheckbox.disabled = true;
usagePingFeaturesCheckbox.checked = false; servicePingFeaturesCheckbox.checked = false;
} }
} }
export default function initSetHelperText() { export default function initSetHelperText() {
const usagePingCheckbox = document.getElementById('application_setting_usage_ping_enabled'); const servicePingCheckbox = document.getElementById('application_setting_usage_ping_enabled');
setHelperText(usagePingCheckbox); setHelperText(servicePingCheckbox);
usagePingCheckbox.addEventListener('change', () => { servicePingCheckbox.addEventListener('change', () => {
setHelperText(usagePingCheckbox); setHelperText(servicePingCheckbox);
}); });
} }
...@@ -13,7 +13,7 @@ The Service Data API is associated with [Service Ping](../development/service_pi ...@@ -13,7 +13,7 @@ The Service Data API is associated with [Service Ping](../development/service_pi
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/57270) in GitLab 13.11. > - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/57270) in GitLab 13.11.
Export all metric definitions as a single YAML file, similar to the [Metrics Dictionary](../development/usage_ping/dictionary.md), for easier importing. Export all metric definitions as a single YAML file, similar to the [Metrics Dictionary](../development/service_ping/dictionary.md), for easier importing.
```plaintext ```plaintext
GET /usage_data/metric_definitions GET /usage_data/metric_definitions
......
...@@ -185,11 +185,11 @@ sequenceDiagram ...@@ -185,11 +185,11 @@ sequenceDiagram
## How Service Ping works ## How Service Ping works
1. The Service Ping [cron job](https://gitlab.com/gitlab-org/gitlab/-/blob/master/app/workers/gitlab_usage_ping_worker.rb#L30) is set in Sidekiq to run weekly. 1. The Service Ping [cron job](https://gitlab.com/gitlab-org/gitlab/-/blob/master/app/workers/gitlab_service_ping_worker.rb#L24) is set in Sidekiq to run weekly.
1. When the cron job runs, it calls [`Gitlab::UsageData.to_json`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/app/services/submit_usage_ping_service.rb#L22). 1. When the cron job runs, it calls [`Gitlab::UsageData.to_json`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/app/services/service_ping/submit_service.rb#L49).
1. `Gitlab::UsageData.to_json` [cascades down](https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/usage_data.rb#L22) to ~400+ other counter method calls. 1. `Gitlab::UsageData.to_json` [cascades down](https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/usage_data.rb) to ~400+ other counter method calls.
1. The response of all methods calls are [merged together](https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/usage_data.rb#L14) into a single JSON payload in `Gitlab::UsageData.to_json`. 1. The response of all methods calls are [merged together](https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/usage_data.rb#L68) into a single JSON payload in `Gitlab::UsageData.to_json`.
1. The JSON payload is then [posted to the Versions application]( https://gitlab.com/gitlab-org/gitlab/-/blob/master/app/services/submit_usage_ping_service.rb#L20) 1. The JSON payload is then [posted to the Versions application](https://gitlab.com/gitlab-org/gitlab/-/blob/master/app/services/service_ping/submit_service.rb#L20)
If a firewall exception is needed, the required URL depends on several things. If If a firewall exception is needed, the required URL depends on several things. If
the hostname is `version.gitlab.com`, the protocol is `TCP`, and the port number is `443`, the hostname is `version.gitlab.com`, the protocol is `TCP`, and the port number is `443`,
the required URL is <https://version.gitlab.com/>. the required URL is <https://version.gitlab.com/>.
...@@ -1140,7 +1140,7 @@ To set up Service Ping locally, you must: ...@@ -1140,7 +1140,7 @@ To set up Service Ping locally, you must:
1. Clone and start [Versions Application](https://gitlab.com/gitlab-services/version-gitlab-com). 1. Clone and start [Versions Application](https://gitlab.com/gitlab-services/version-gitlab-com).
Make sure to run `docker-compose up` to start a PostgreSQL and Redis instance. Make sure to run `docker-compose up` to start a PostgreSQL and Redis instance.
1. Point GitLab to the Versions Application endpoint instead of the default endpoint: 1. Point GitLab to the Versions Application endpoint instead of the default endpoint:
1. Open [submit_usage_ping_service.rb](https://gitlab.com/gitlab-org/gitlab/-/blob/master/app/services/submit_usage_ping_service.rb#L4) in your local and modified `PRODUCTION_URL`. 1. Open [service_ping/submit_service.rb](https://gitlab.com/gitlab-org/gitlab/-/blob/master/app/services/service_ping/submit_service.rb#L5) in your local and modified `PRODUCTION_URL`.
1. Set it to the local Versions Application URL `http://localhost:3000/usage_data`. 1. Set it to the local Versions Application URL `http://localhost:3000/usage_data`.
#### Test local setup #### Test local setup
......
...@@ -25,7 +25,7 @@ any of the following Service Ping files: ...@@ -25,7 +25,7 @@ any of the following Service Ping files:
- The Metrics Dictionary, including files in: - The Metrics Dictionary, including files in:
- [`config/metrics`](https://gitlab.com/gitlab-org/gitlab/-/tree/master/config/metrics). - [`config/metrics`](https://gitlab.com/gitlab-org/gitlab/-/tree/master/config/metrics).
- [`ee/config/metrics`](https://gitlab.com/gitlab-org/gitlab/-/tree/master/ee/config/metrics). - [`ee/config/metrics`](https://gitlab.com/gitlab-org/gitlab/-/tree/master/ee/config/metrics).
- [`dictionary.md`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/doc/development/usage_ping/dictionary.md). - [`dictionary.md`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/doc/development/service_ping/dictionary.md).
- [`schema.json`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/config/metrics/schema.json). - [`schema.json`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/config/metrics/schema.json).
- Product Intelligence tooling. For example, - Product Intelligence tooling. For example,
[`Gitlab::UsageMetricDefinitionGenerator`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/generators/gitlab/usage_metric_definition_generator.rb) [`Gitlab::UsageMetricDefinitionGenerator`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/generators/gitlab/usage_metric_definition_generator.rb)
...@@ -48,7 +48,7 @@ are regular backend changes. ...@@ -48,7 +48,7 @@ are regular backend changes.
- `product_section`, `product_stage`, `product_group`, `product_category` - `product_section`, `product_stage`, `product_group`, `product_category`
- Provide a clear description of the metric. - Provide a clear description of the metric.
- Update the - Update the
[Metrics Dictionary](https://gitlab.com/gitlab-org/gitlab/-/blob/master/doc/development/usage_ping/dictionary.md) if needed. [Metrics Dictionary](https://gitlab.com/gitlab-org/gitlab/-/blob/master/doc/development/service_ping/dictionary.md) if needed.
- Add a changelog [according to guidelines](../changelog.md). - Add a changelog [according to guidelines](../changelog.md).
#### The Product Intelligence **reviewer** should #### The Product Intelligence **reviewer** should
......
...@@ -102,7 +102,7 @@ This feature was formerly known as Seat Link. ...@@ -102,7 +102,7 @@ This feature was formerly known as Seat Link.
#### Operational data #### Operational data
Usage data helps GitLab improve the product experience and provide proactive support. Service data helps GitLab improve the product experience and provide proactive support.
Most data is categorized as optional and can be disabled. Data that is categorized as Most data is categorized as optional and can be disabled. Data that is categorized as
operational, like number of issues, pipelines, merge requests, and version, is not configurable. operational, like number of issues, pipelines, merge requests, and version, is not configurable.
......
...@@ -5,53 +5,53 @@ import initSetHelperText, { ...@@ -5,53 +5,53 @@ import initSetHelperText, {
describe('UsageStatistics', () => { describe('UsageStatistics', () => {
const FIXTURE = 'application_settings/usage.html'; const FIXTURE = 'application_settings/usage.html';
let usagePingCheckBox; let servicePingCheckBox;
let usagePingFeaturesCheckBox; let servicePingFeaturesCheckBox;
let usagePingFeaturesLabel; let servicePingFeaturesLabel;
let usagePingFeaturesHelperText; let servicePingFeaturesHelperText;
beforeEach(() => { beforeEach(() => {
loadFixtures(FIXTURE); loadFixtures(FIXTURE);
initSetHelperText(); initSetHelperText();
usagePingCheckBox = document.getElementById('application_setting_usage_ping_enabled'); servicePingCheckBox = document.getElementById('application_setting_usage_ping_enabled');
usagePingFeaturesCheckBox = document.getElementById( servicePingFeaturesCheckBox = document.getElementById(
'application_setting_usage_ping_features_enabled', 'application_setting_usage_ping_features_enabled',
); );
usagePingFeaturesLabel = document.getElementById('service_ping_features_label'); servicePingFeaturesLabel = document.getElementById('service_ping_features_label');
usagePingFeaturesHelperText = document.getElementById('service_ping_features_helper_text'); servicePingFeaturesHelperText = document.getElementById('service_ping_features_helper_text');
}); });
const expectEnabledUsagePingFeaturesCheckBox = () => { const expectEnabledservicePingFeaturesCheckBox = () => {
expect(usagePingFeaturesCheckBox.classList.contains('gl-cursor-not-allowed')).toBe(false); expect(servicePingFeaturesCheckBox.classList.contains('gl-cursor-not-allowed')).toBe(false);
expect(usagePingFeaturesHelperText.textContent).toEqual(HELPER_TEXT_SERVICE_PING_ENABLED); expect(servicePingFeaturesHelperText.textContent).toEqual(HELPER_TEXT_SERVICE_PING_ENABLED);
}; };
const expectDisabledUsagePingFeaturesCheckBox = () => { const expectDisabledservicePingFeaturesCheckBox = () => {
expect(usagePingFeaturesLabel.classList.contains('gl-cursor-not-allowed')).toBe(true); expect(servicePingFeaturesLabel.classList.contains('gl-cursor-not-allowed')).toBe(true);
expect(usagePingFeaturesHelperText.textContent).toEqual(HELPER_TEXT_SERVICE_PING_DISABLED); expect(servicePingFeaturesHelperText.textContent).toEqual(HELPER_TEXT_SERVICE_PING_DISABLED);
}; };
describe('Registration Features checkbox', () => { describe('Registration Features checkbox', () => {
it('is disabled when Usage Ping checkbox is unchecked', () => { it('is disabled when Service Ping checkbox is unchecked', () => {
expect(usagePingCheckBox.checked).toBe(false); expect(servicePingCheckBox.checked).toBe(false);
expectDisabledUsagePingFeaturesCheckBox(); expectDisabledservicePingFeaturesCheckBox();
}); });
it('is enabled when Usage Ping checkbox is checked', () => { it('is enabled when Servie Ping checkbox is checked', () => {
usagePingCheckBox.click(); servicePingCheckBox.click();
expect(usagePingCheckBox.checked).toBe(true); expect(servicePingCheckBox.checked).toBe(true);
expectEnabledUsagePingFeaturesCheckBox(); expectEnabledservicePingFeaturesCheckBox();
}); });
it('is switched to disabled when Usage Ping checkbox is unchecked ', () => { it('is switched to disabled when Service Ping checkbox is unchecked ', () => {
usagePingCheckBox.click(); servicePingCheckBox.click();
usagePingFeaturesCheckBox.click(); servicePingFeaturesCheckBox.click();
expectEnabledUsagePingFeaturesCheckBox(); expectEnabledservicePingFeaturesCheckBox();
usagePingCheckBox.click(); servicePingCheckBox.click();
expect(usagePingCheckBox.checked).toBe(false); expect(servicePingCheckBox.checked).toBe(false);
expect(usagePingFeaturesCheckBox.checked).toBe(false); expect(servicePingFeaturesCheckBox.checked).toBe(false);
expectDisabledUsagePingFeaturesCheckBox(); expectDisabledservicePingFeaturesCheckBox();
}); });
}); });
}); });
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