Commit 55eb443c authored by Luke Duncalfe's avatar Luke Duncalfe

Merge branch...

Merge branch '334569-follow-up-pass-for-renaming-usage-ping-data-to-service-ping-data' into 'master'

Follow-up pass for renaming Usage Ping/Data to Service Ping/Data

See merge request gitlab-org/gitlab!66990
parents 14af275d 26f3da5a
......@@ -1641,7 +1641,7 @@ Gitlab/NamespacedClass:
- 'app/services/reset_project_cache_service.rb'
- 'app/services/search_service.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/task_list_toggle_service.rb'
- 'app/services/todo_service.rb'
......
......@@ -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.',
);
function setHelperText(usagePingCheckbox) {
function setHelperText(servicePingCheckbox) {
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',
);
helperTextId.textContent = usagePingCheckbox.checked
helperTextId.textContent = servicePingCheckbox.checked
? HELPER_TEXT_SERVICE_PING_ENABLED
: 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) {
usagePingFeaturesCheckbox.disabled = true;
usagePingFeaturesCheckbox.checked = false;
if (!servicePingCheckbox.checked) {
servicePingFeaturesCheckbox.disabled = true;
servicePingFeaturesCheckbox.checked = false;
}
}
export default function initSetHelperText() {
const usagePingCheckbox = document.getElementById('application_setting_usage_ping_enabled');
const servicePingCheckbox = document.getElementById('application_setting_usage_ping_enabled');
setHelperText(usagePingCheckbox);
usagePingCheckbox.addEventListener('change', () => {
setHelperText(usagePingCheckbox);
setHelperText(servicePingCheckbox);
servicePingCheckbox.addEventListener('change', () => {
setHelperText(servicePingCheckbox);
});
}
......@@ -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.
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
GET /usage_data/metric_definitions
......
......@@ -185,11 +185,11 @@ sequenceDiagram
## 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. 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. `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. 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 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 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/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) 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#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/service_ping/submit_service.rb#L20)
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 required URL is <https://version.gitlab.com/>.
......@@ -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).
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. 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`.
#### Test local setup
......
......@@ -25,7 +25,7 @@ any of the following Service Ping files:
- The Metrics Dictionary, including files in:
- [`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).
- [`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).
- Product Intelligence tooling. For example,
[`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.
- `product_section`, `product_stage`, `product_group`, `product_category`
- Provide a clear description of the metric.
- 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).
#### The Product Intelligence **reviewer** should
......
......@@ -102,7 +102,7 @@ This feature was formerly known as Seat Link.
#### 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
operational, like number of issues, pipelines, merge requests, and version, is not configurable.
......
......@@ -5,53 +5,53 @@ import initSetHelperText, {
describe('UsageStatistics', () => {
const FIXTURE = 'application_settings/usage.html';
let usagePingCheckBox;
let usagePingFeaturesCheckBox;
let usagePingFeaturesLabel;
let usagePingFeaturesHelperText;
let servicePingCheckBox;
let servicePingFeaturesCheckBox;
let servicePingFeaturesLabel;
let servicePingFeaturesHelperText;
beforeEach(() => {
loadFixtures(FIXTURE);
initSetHelperText();
usagePingCheckBox = document.getElementById('application_setting_usage_ping_enabled');
usagePingFeaturesCheckBox = document.getElementById(
servicePingCheckBox = document.getElementById('application_setting_usage_ping_enabled');
servicePingFeaturesCheckBox = document.getElementById(
'application_setting_usage_ping_features_enabled',
);
usagePingFeaturesLabel = document.getElementById('service_ping_features_label');
usagePingFeaturesHelperText = document.getElementById('service_ping_features_helper_text');
servicePingFeaturesLabel = document.getElementById('service_ping_features_label');
servicePingFeaturesHelperText = document.getElementById('service_ping_features_helper_text');
});
const expectEnabledUsagePingFeaturesCheckBox = () => {
expect(usagePingFeaturesCheckBox.classList.contains('gl-cursor-not-allowed')).toBe(false);
expect(usagePingFeaturesHelperText.textContent).toEqual(HELPER_TEXT_SERVICE_PING_ENABLED);
const expectEnabledservicePingFeaturesCheckBox = () => {
expect(servicePingFeaturesCheckBox.classList.contains('gl-cursor-not-allowed')).toBe(false);
expect(servicePingFeaturesHelperText.textContent).toEqual(HELPER_TEXT_SERVICE_PING_ENABLED);
};
const expectDisabledUsagePingFeaturesCheckBox = () => {
expect(usagePingFeaturesLabel.classList.contains('gl-cursor-not-allowed')).toBe(true);
expect(usagePingFeaturesHelperText.textContent).toEqual(HELPER_TEXT_SERVICE_PING_DISABLED);
const expectDisabledservicePingFeaturesCheckBox = () => {
expect(servicePingFeaturesLabel.classList.contains('gl-cursor-not-allowed')).toBe(true);
expect(servicePingFeaturesHelperText.textContent).toEqual(HELPER_TEXT_SERVICE_PING_DISABLED);
};
describe('Registration Features checkbox', () => {
it('is disabled when Usage Ping checkbox is unchecked', () => {
expect(usagePingCheckBox.checked).toBe(false);
expectDisabledUsagePingFeaturesCheckBox();
it('is disabled when Service Ping checkbox is unchecked', () => {
expect(servicePingCheckBox.checked).toBe(false);
expectDisabledservicePingFeaturesCheckBox();
});
it('is enabled when Usage Ping checkbox is checked', () => {
usagePingCheckBox.click();
expect(usagePingCheckBox.checked).toBe(true);
expectEnabledUsagePingFeaturesCheckBox();
it('is enabled when Servie Ping checkbox is checked', () => {
servicePingCheckBox.click();
expect(servicePingCheckBox.checked).toBe(true);
expectEnabledservicePingFeaturesCheckBox();
});
it('is switched to disabled when Usage Ping checkbox is unchecked ', () => {
usagePingCheckBox.click();
usagePingFeaturesCheckBox.click();
expectEnabledUsagePingFeaturesCheckBox();
it('is switched to disabled when Service Ping checkbox is unchecked ', () => {
servicePingCheckBox.click();
servicePingFeaturesCheckBox.click();
expectEnabledservicePingFeaturesCheckBox();
usagePingCheckBox.click();
expect(usagePingCheckBox.checked).toBe(false);
expect(usagePingFeaturesCheckBox.checked).toBe(false);
expectDisabledUsagePingFeaturesCheckBox();
servicePingCheckBox.click();
expect(servicePingCheckBox.checked).toBe(false);
expect(servicePingFeaturesCheckBox.checked).toBe(false);
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