From 557b51880fbcff2f57ab262e6b40bbb6eb1bf8b3 Mon Sep 17 00:00:00 2001 From: Bishoy Boktor Date: Fri, 5 Feb 2021 20:59:54 +0000 Subject: [PATCH 1/3] [PURIFY] Removes telemetry publishing and telemetry section from advanced settings (#10) --- packages/kbn-analytics/src/reporter.ts | 6 +++--- src/plugins/data/kibana.json | 12 ++---------- .../public/application/components/welcome.test.tsx | 4 ++-- src/plugins/telemetry/common/constants.ts | 2 +- .../telemetry/{kibana.json => kibana_back.json} | 0 .../public/components/opt_in_banner.test.tsx | 2 +- .../public/components/opt_in_message.test.tsx | 2 +- .../components/opted_in_notice_banner.test.tsx | 2 +- .../render_opt_in_banner.test.ts | 2 +- .../render_opted_in_notice_banner.test.ts | 2 +- .../telemetry_notifications.test.ts | 6 +++--- .../public/services/telemetry_sender.test.ts | 12 ++++++------ .../telemetry/public/services/telemetry_sender.ts | 6 ++++-- .../public/services/telemetry_service.test.ts | 14 +++++++------- .../telemetry/public/services/telemetry_service.ts | 5 ++++- src/plugins/telemetry/server/fetcher.test.ts | 4 ++-- .../telemetry_collection/get_cluster_info.test.ts | 2 +- .../telemetry_collection/get_cluster_stats.test.ts | 2 +- .../get_data_telemetry/get_data_telemetry.test.ts | 10 +++++----- .../telemetry_collection/get_local_stats.test.ts | 6 +++--- .../telemetry_collection/get_nodes_usage.test.ts | 2 +- .../get_telemetry_saved_object.test.ts | 2 +- .../{kibana.json => kibana_back.json} | 0 .../{kibana.json => kibana_back.json} | 0 .../components/opt_in_example_flyout.test.tsx | 2 +- .../opt_in_security_example_flyout.test.tsx | 2 +- .../telemetry_management_section.test.tsx | 2 +- .../server/routes/report_metrics.ts | 3 ++- test/common/config.js | 8 ++++---- test/functional/config.js | 2 +- test/new_visualize_flow/config.ts | 2 +- 31 files changed, 62 insertions(+), 64 deletions(-) rename src/plugins/telemetry/{kibana.json => kibana_back.json} (100%) rename src/plugins/telemetry_collection_manager/{kibana.json => kibana_back.json} (100%) rename src/plugins/telemetry_management_section/{kibana.json => kibana_back.json} (100%) diff --git a/packages/kbn-analytics/src/reporter.ts b/packages/kbn-analytics/src/reporter.ts index b20ddc0e58ba..63bccdd24aea 100644 --- a/packages/kbn-analytics/src/reporter.ts +++ b/packages/kbn-analytics/src/reporter.ts @@ -133,14 +133,14 @@ export class Reporter { public reportApplicationUsage(appId?: string) { this.log(`Reporting application changed to ${appId}`); this.lastAppId = appId || this.lastAppId; - const appChangedReport = this.applicationUsage.appChanged(appId); - if (appChangedReport) this.saveToReport([appChangedReport]); + // const appChangedReport = this.applicationUsage.appChanged(appId); + // if (appChangedReport) this.saveToReport([appChangedReport]); } public sendReports = async () => { if (!this.reportManager.isReportEmpty()) { try { - await this.http(this.reportManager.report); + // await this.http(this.reportManager.report); this.flushReport(); } catch (err) { this.log(`Error Sending Metrics Report ${err}`); diff --git a/src/plugins/data/kibana.json b/src/plugins/data/kibana.json index 9cb9b1745373..466e5f75493b 100644 --- a/src/plugins/data/kibana.json +++ b/src/plugins/data/kibana.json @@ -3,16 +3,8 @@ "version": "kibana", "server": true, "ui": true, - "requiredPlugins": [ - "expressions", - "uiActions" - ], + "requiredPlugins": ["expressions", "uiActions"], "optionalPlugins": ["usageCollection"], "extraPublicDirs": ["common", "common/utils/abort_utils"], - "requiredBundles": [ - "usageCollection", - "kibanaUtils", - "kibanaReact", - "inspector" - ] + "requiredBundles": ["usageCollection", "kibanaUtils", "kibanaReact", "inspector"] } diff --git a/src/plugins/home/public/application/components/welcome.test.tsx b/src/plugins/home/public/application/components/welcome.test.tsx index 701fab3af753..14b5e632f35a 100644 --- a/src/plugins/home/public/application/components/welcome.test.tsx +++ b/src/plugins/home/public/application/components/welcome.test.tsx @@ -28,14 +28,14 @@ jest.mock('../kibana_services', () => ({ trackUiMetric: () => {}, }), })); - +/* test('should render a Welcome screen with the telemetry disclaimer', () => { const telemetry = telemetryPluginMock.createStartContract(); const component = shallow( {}} telemetry={telemetry} />); expect(component).toMatchSnapshot(); }); - +*/ test('should render a Welcome screen with the telemetry disclaimer when optIn is true', () => { const telemetry = telemetryPluginMock.createStartContract(); telemetry.telemetryService.getIsOptedIn = jest.fn().mockReturnValue(true); diff --git a/src/plugins/telemetry/common/constants.ts b/src/plugins/telemetry/common/constants.ts index fc77332c18fc..79a131bbbe31 100644 --- a/src/plugins/telemetry/common/constants.ts +++ b/src/plugins/telemetry/common/constants.ts @@ -54,7 +54,7 @@ export const PATH_TO_ADVANCED_SETTINGS = 'management/kibana/settings'; /** * Link to the Elastic Telemetry privacy statement. */ -export const PRIVACY_STATEMENT_URL = `https://www.elastic.co/legal/privacy-statement`; +export const PRIVACY_STATEMENT_URL = ``; /** * The endpoint version when hitting the remote telemetry service diff --git a/src/plugins/telemetry/kibana.json b/src/plugins/telemetry/kibana_back.json similarity index 100% rename from src/plugins/telemetry/kibana.json rename to src/plugins/telemetry/kibana_back.json diff --git a/src/plugins/telemetry/public/components/opt_in_banner.test.tsx b/src/plugins/telemetry/public/components/opt_in_banner.test.tsx index 097c17862c66..24f1b22560b3 100644 --- a/src/plugins/telemetry/public/components/opt_in_banner.test.tsx +++ b/src/plugins/telemetry/public/components/opt_in_banner.test.tsx @@ -21,7 +21,7 @@ import { EuiButton } from '@elastic/eui'; import { shallowWithIntl } from 'test_utils/enzyme_helpers'; import { OptInBanner } from './opt_in_banner'; -describe('OptInDetailsComponent', () => { +describe.skip('OptInDetailsComponent', () => { it('renders as expected', () => { expect(shallowWithIntl( {}} />)).toMatchSnapshot(); }); diff --git a/src/plugins/telemetry/public/components/opt_in_message.test.tsx b/src/plugins/telemetry/public/components/opt_in_message.test.tsx index dbe0941345a0..ddb2b64c59c6 100644 --- a/src/plugins/telemetry/public/components/opt_in_message.test.tsx +++ b/src/plugins/telemetry/public/components/opt_in_message.test.tsx @@ -20,7 +20,7 @@ import React from 'react'; import { shallowWithIntl } from 'test_utils/enzyme_helpers'; import { OptInMessage } from './opt_in_message'; -describe('OptInMessage', () => { +describe.skip('OptInMessage', () => { it('renders as expected', () => { expect(shallowWithIntl()).toMatchSnapshot(); }); diff --git a/src/plugins/telemetry/public/components/opted_in_notice_banner.test.tsx b/src/plugins/telemetry/public/components/opted_in_notice_banner.test.tsx index f4e0287cab93..f019d8fc5820 100644 --- a/src/plugins/telemetry/public/components/opted_in_notice_banner.test.tsx +++ b/src/plugins/telemetry/public/components/opted_in_notice_banner.test.tsx @@ -21,7 +21,7 @@ import { EuiButton } from '@elastic/eui'; import { shallowWithIntl } from 'test_utils/enzyme_helpers'; import { OptedInNoticeBanner } from './opted_in_notice_banner'; -describe('OptInDetailsComponent', () => { +describe.skip('OptInDetailsComponent', () => { it('renders as expected', () => { expect(shallowWithIntl( {}} />)).toMatchSnapshot(); }); diff --git a/src/plugins/telemetry/public/services/telemetry_notifications/render_opt_in_banner.test.ts b/src/plugins/telemetry/public/services/telemetry_notifications/render_opt_in_banner.test.ts index 020d8023b600..0ed457d152be 100644 --- a/src/plugins/telemetry/public/services/telemetry_notifications/render_opt_in_banner.test.ts +++ b/src/plugins/telemetry/public/services/telemetry_notifications/render_opt_in_banner.test.ts @@ -21,7 +21,7 @@ import { renderOptInBanner } from './render_opt_in_banner'; // eslint-disable-next-line @kbn/eslint/no-restricted-paths import { overlayServiceMock } from '../../../../../core/public/overlays/overlay_service.mock'; -describe('renderOptInBanner', () => { +describe.skip('renderOptInBanner', () => { it('adds a banner to banners with priority of 10000', () => { const bannerID = 'brucer-wayne'; const overlays = overlayServiceMock.createStartContract(); diff --git a/src/plugins/telemetry/public/services/telemetry_notifications/render_opted_in_notice_banner.test.ts b/src/plugins/telemetry/public/services/telemetry_notifications/render_opted_in_notice_banner.test.ts index 2d175024a74f..4a2b948af109 100644 --- a/src/plugins/telemetry/public/services/telemetry_notifications/render_opted_in_notice_banner.test.ts +++ b/src/plugins/telemetry/public/services/telemetry_notifications/render_opted_in_notice_banner.test.ts @@ -21,7 +21,7 @@ import { renderOptedInNoticeBanner } from './render_opted_in_notice_banner'; // eslint-disable-next-line @kbn/eslint/no-restricted-paths import { overlayServiceMock } from '../../../../../core/public/overlays/overlay_service.mock'; -describe('renderOptedInNoticeBanner', () => { +describe.skip('renderOptedInNoticeBanner', () => { it('adds a banner to banners with priority of 10000', () => { const bannerID = 'brucer-wayne'; const overlays = overlayServiceMock.createStartContract(); diff --git a/src/plugins/telemetry/public/services/telemetry_notifications/telemetry_notifications.test.ts b/src/plugins/telemetry/public/services/telemetry_notifications/telemetry_notifications.test.ts index fd9a19c44161..f1758ff3eff5 100644 --- a/src/plugins/telemetry/public/services/telemetry_notifications/telemetry_notifications.test.ts +++ b/src/plugins/telemetry/public/services/telemetry_notifications/telemetry_notifications.test.ts @@ -20,7 +20,7 @@ /* eslint-disable dot-notation */ import { mockTelemetryNotifications, mockTelemetryService } from '../../mocks'; -describe('onSetOptInClick', () => { +describe.skip('onSetOptInClick', () => { it('sets setting successfully and removes banner', async () => { const optIn = true; const bannerId = 'bruce-banner'; @@ -38,7 +38,7 @@ describe('onSetOptInClick', () => { }); }); -describe('setOptedInNoticeSeen', () => { +describe.skip('setOptedInNoticeSeen', () => { it('sets setting successfully and removes banner', async () => { const bannerId = 'bruce-banner'; @@ -54,7 +54,7 @@ describe('setOptedInNoticeSeen', () => { }); }); -describe('shouldShowOptedInNoticeBanner', () => { +describe.skip('shouldShowOptedInNoticeBanner', () => { it("should return true because a banner hasn't been shown, the notice hasn't been seen and the user has privileges to edit saved objects", () => { const telemetryService = mockTelemetryService(); telemetryService.getUserShouldSeeOptInNotice = jest.fn().mockReturnValue(true); diff --git a/src/plugins/telemetry/public/services/telemetry_sender.test.ts b/src/plugins/telemetry/public/services/telemetry_sender.test.ts index 9d052254c46c..67570135a60e 100644 --- a/src/plugins/telemetry/public/services/telemetry_sender.test.ts +++ b/src/plugins/telemetry/public/services/telemetry_sender.test.ts @@ -32,7 +32,7 @@ Object.defineProperty(window, 'localStorage', { value: mockLocalStorage, }); -describe('TelemetrySender', () => { +describe.skip('TelemetrySender', () => { beforeEach(() => { mockLocalStorage.getItem.mockClear(); mockLocalStorage.setItem.mockClear(); @@ -43,7 +43,7 @@ describe('TelemetrySender', () => { }) ); - describe('constructor', () => { + describe.skip('constructor', () => { it('defaults lastReport if unset', () => { const telemetryService = mockTelemetryService(); const telemetrySender = new TelemetrySender(telemetryService); @@ -61,7 +61,7 @@ describe('TelemetrySender', () => { }); }); - describe('saveToBrowser', () => { + describe.skip('saveToBrowser', () => { it('uses lastReport', () => { const lastReport = `${Date.now()}`; const telemetryService = mockTelemetryService(); @@ -77,7 +77,7 @@ describe('TelemetrySender', () => { }); }); - describe('shouldSendReport', () => { + describe.skip('shouldSendReport', () => { it('returns false whenever optIn is false', () => { const telemetryService = mockTelemetryService(); telemetryService.getIsOptedIn = jest.fn().mockReturnValue(false); @@ -129,7 +129,7 @@ describe('TelemetrySender', () => { expect(shouldSendRerpot).toBe(true); }); - describe('sendIfDue', () => { + describe.skip('sendIfDue', () => { let originalFetch: typeof window['fetch']; let mockFetch: jest.Mock; @@ -252,7 +252,7 @@ describe('TelemetrySender', () => { }); }); }); - describe('startChecking', () => { + describe.skip('startChecking', () => { let originalSetInterval: typeof window['setInterval']; let mockSetInterval: jest.Mock; diff --git a/src/plugins/telemetry/public/services/telemetry_sender.ts b/src/plugins/telemetry/public/services/telemetry_sender.ts index b28482c14482..6770bc9b24e6 100644 --- a/src/plugins/telemetry/public/services/telemetry_sender.ts +++ b/src/plugins/telemetry/public/services/telemetry_sender.ts @@ -47,13 +47,15 @@ export class TelemetrySender { // check if opt-in for telemetry is enabled if (this.telemetryService.getIsOptedIn()) { if (!this.lastReported) { - return true; + // return true; + return false; } // returns NaN for any malformed or unset (null/undefined) value const lastReported = parseInt(this.lastReported, 10); // If it's been a day since we last sent telemetry if (isNaN(lastReported) || Date.now() - lastReported > REPORT_INTERVAL_MS) { - return true; + // return true; + return false; } } diff --git a/src/plugins/telemetry/public/services/telemetry_service.test.ts b/src/plugins/telemetry/public/services/telemetry_service.test.ts index 655bbfe746c2..f4a334eca96a 100644 --- a/src/plugins/telemetry/public/services/telemetry_service.test.ts +++ b/src/plugins/telemetry/public/services/telemetry_service.test.ts @@ -44,8 +44,8 @@ jest.mock('moment', () => { }); }); -describe('TelemetryService', () => { - describe('fetchTelemetry', () => { +describe.skip('TelemetryService', () => { + describe.skip('fetchTelemetry', () => { it('calls expected URL with 20 minutes - now', async () => { const telemetryService = mockTelemetryService(); await telemetryService.fetchTelemetry(); @@ -57,7 +57,7 @@ describe('TelemetryService', () => { }); }); - describe('fetchExample', () => { + describe.skip('fetchExample', () => { it('calls fetchTelemetry with unencrupted: true', async () => { const telemetryService = mockTelemetryService(); telemetryService.fetchTelemetry = jest.fn(); @@ -66,7 +66,7 @@ describe('TelemetryService', () => { }); }); - describe('setOptIn', () => { + describe.skip('setOptIn', () => { it('does not call the api if canChangeOptInStatus==false', async () => { const telemetryService = mockTelemetryService({ reportOptInStatusChange: false, @@ -170,7 +170,7 @@ describe('TelemetryService', () => { }); }); - describe('getTelemetryUrl', () => { + describe.skip('getTelemetryUrl', () => { it('should return the config.url parameter', async () => { const url = 'http://test.com'; const telemetryService = mockTelemetryService({ @@ -181,7 +181,7 @@ describe('TelemetryService', () => { }); }); - describe('setUserHasSeenNotice', () => { + describe.skip('setUserHasSeenNotice', () => { it('should hit the API and change the config', async () => { const telemetryService = mockTelemetryService({ config: { telemetryNotifyUserAboutOptInDefault: undefined, userCanChangeSettings: true }, @@ -216,7 +216,7 @@ describe('TelemetryService', () => { }); }); - describe('getUserShouldSeeOptInNotice', () => { + describe.skip('getUserShouldSeeOptInNotice', () => { it('returns whether the user can update the telemetry config (has SavedObjects access)', () => { const telemetryService = mockTelemetryService({ config: { userCanChangeSettings: undefined }, diff --git a/src/plugins/telemetry/public/services/telemetry_service.ts b/src/plugins/telemetry/public/services/telemetry_service.ts index c807aa9e1d35..c6b37f497ecb 100644 --- a/src/plugins/telemetry/public/services/telemetry_service.ts +++ b/src/plugins/telemetry/public/services/telemetry_service.ts @@ -57,10 +57,13 @@ export class TelemetryService { } public get isOptedIn() { - return this.config.optIn; + // return this.config.optIn; + return false; } public set isOptedIn(optIn) { + // set to always false + optIn = false; this.config = { ...this.config, optIn }; } diff --git a/src/plugins/telemetry/server/fetcher.test.ts b/src/plugins/telemetry/server/fetcher.test.ts index 45712df772e1..6753b2b1134c 100644 --- a/src/plugins/telemetry/server/fetcher.test.ts +++ b/src/plugins/telemetry/server/fetcher.test.ts @@ -21,8 +21,8 @@ import { FetcherTask } from './fetcher'; import { coreMock } from '../../../core/server/mocks'; -describe('FetcherTask', () => { - describe('sendIfDue', () => { +describe.skip('FetcherTask', () => { + describe.skip('sendIfDue', () => { it('stops when it fails to get telemetry configs', async () => { const initializerContext = coreMock.createPluginInitializerContext({}); const fetcherTask = new FetcherTask(initializerContext); diff --git a/src/plugins/telemetry/server/telemetry_collection/get_cluster_info.test.ts b/src/plugins/telemetry/server/telemetry_collection/get_cluster_info.test.ts index 459b18d252e1..3f548b1c9823 100644 --- a/src/plugins/telemetry/server/telemetry_collection/get_cluster_info.test.ts +++ b/src/plugins/telemetry/server/telemetry_collection/get_cluster_info.test.ts @@ -33,7 +33,7 @@ export function mockGetClusterInfo(clusterInfo: any) { return esClient; } -describe('get_cluster_info using the elasticsearch client', () => { +describe.skip('get_cluster_info using the elasticsearch client', () => { it('uses the esClient to get info API', async () => { const clusterInfo = { cluster_uuid: '1234', diff --git a/src/plugins/telemetry/server/telemetry_collection/get_cluster_stats.test.ts b/src/plugins/telemetry/server/telemetry_collection/get_cluster_stats.test.ts index 81551c0c4d93..cfabc94e52e6 100644 --- a/src/plugins/telemetry/server/telemetry_collection/get_cluster_stats.test.ts +++ b/src/plugins/telemetry/server/telemetry_collection/get_cluster_stats.test.ts @@ -27,7 +27,7 @@ export function mockGetClusterStats(clusterStats: any) { return esClient; } -describe('get_cluster_stats', () => { +describe.skip('get_cluster_stats', () => { it('uses the esClient to get the response from the `cluster.stats` API', async () => { const response = Promise.resolve({ body: { cluster_uuid: '1234' } }); const esClient = elasticsearchServiceMock.createClusterClient().asInternalUser; diff --git a/src/plugins/telemetry/server/telemetry_collection/get_data_telemetry/get_data_telemetry.test.ts b/src/plugins/telemetry/server/telemetry_collection/get_data_telemetry/get_data_telemetry.test.ts index bb5eb7f6b726..35d26b26d595 100644 --- a/src/plugins/telemetry/server/telemetry_collection/get_data_telemetry/get_data_telemetry.test.ts +++ b/src/plugins/telemetry/server/telemetry_collection/get_data_telemetry/get_data_telemetry.test.ts @@ -21,10 +21,10 @@ import { buildDataTelemetryPayload, getDataTelemetry } from './get_data_telemetr import { DATA_DATASETS_INDEX_PATTERNS, DATA_DATASETS_INDEX_PATTERNS_UNIQUE } from './constants'; import { elasticsearchServiceMock } from '../../../../../../src/core/server/mocks'; -describe('get_data_telemetry', () => { - describe('DATA_DATASETS_INDEX_PATTERNS', () => { +describe.skip('get_data_telemetry', () => { + describe.skip('DATA_DATASETS_INDEX_PATTERNS', () => { DATA_DATASETS_INDEX_PATTERNS.forEach((entry, index, array) => { - describe(`Pattern ${entry.pattern}`, () => { + describe.skip(`Pattern ${entry.pattern}`, () => { test('there should only be one in DATA_DATASETS_INDEX_PATTERNS_UNIQUE', () => { expect( DATA_DATASETS_INDEX_PATTERNS_UNIQUE.filter(({ pattern }) => pattern === entry.pattern) @@ -43,7 +43,7 @@ describe('get_data_telemetry', () => { }); }); - describe('buildDataTelemetryPayload', () => { + describe.skip('buildDataTelemetryPayload', () => { test('return the base object when no indices provided', () => { expect(buildDataTelemetryPayload([])).toStrictEqual([]); }); @@ -194,7 +194,7 @@ describe('get_data_telemetry', () => { }); }); - describe('getDataTelemetry', () => { + describe.skip('getDataTelemetry', () => { test('it returns the base payload (all 0s) because no indices are found', async () => { const esClient = mockEsClient(); await expect(getDataTelemetry(esClient)).resolves.toStrictEqual([]); diff --git a/src/plugins/telemetry/server/telemetry_collection/get_local_stats.test.ts b/src/plugins/telemetry/server/telemetry_collection/get_local_stats.test.ts index 0c8b0b249f7d..6e51d699d52d 100644 --- a/src/plugins/telemetry/server/telemetry_collection/get_local_stats.test.ts +++ b/src/plugins/telemetry/server/telemetry_collection/get_local_stats.test.ts @@ -79,7 +79,7 @@ function mockGetLocalStats(clusterInfo: any, clusterStats: any) { return esClient; } -describe('get_local_stats', () => { +describe.skip('get_local_stats', () => { const clusterUuid = 'abc123'; const clusterName = 'my-cool-cluster'; const version = '2.3.4'; @@ -181,7 +181,7 @@ describe('get_local_stats', () => { version: '8.0.0', }; - describe('handleLocalStats', () => { + describe.skip('handleLocalStats', () => { it('returns expected object without xpack or kibana data', () => { const result = handleLocalStats( clusterInfo, @@ -222,7 +222,7 @@ describe('get_local_stats', () => { }); }); - describe('getLocalStats', () => { + describe.skip('getLocalStats', () => { it('returns expected object with kibana data', async () => { const callCluster = jest.fn(); const usageCollection = mockUsageCollection(kibana); diff --git a/src/plugins/telemetry/server/telemetry_collection/get_nodes_usage.test.ts b/src/plugins/telemetry/server/telemetry_collection/get_nodes_usage.test.ts index acf403ba2544..1d19ea54bff1 100644 --- a/src/plugins/telemetry/server/telemetry_collection/get_nodes_usage.test.ts +++ b/src/plugins/telemetry/server/telemetry_collection/get_nodes_usage.test.ts @@ -46,7 +46,7 @@ const mockedNodesFetchResponse = { }, }; -describe('get_nodes_usage', () => { +describe.skip('get_nodes_usage', () => { it('returns a modified array of nodes usage data', async () => { const response = Promise.resolve({ body: mockedNodesFetchResponse }); const esClient = elasticsearchServiceMock.createClusterClient().asInternalUser; diff --git a/src/plugins/telemetry/server/telemetry_repository/get_telemetry_saved_object.test.ts b/src/plugins/telemetry/server/telemetry_repository/get_telemetry_saved_object.test.ts index ebb583e88d4e..dc3b4d684850 100644 --- a/src/plugins/telemetry/server/telemetry_repository/get_telemetry_saved_object.test.ts +++ b/src/plugins/telemetry/server/telemetry_repository/get_telemetry_saved_object.test.ts @@ -20,7 +20,7 @@ import { getTelemetrySavedObject } from './get_telemetry_saved_object'; import { SavedObjectsErrorHelpers } from '../../../../core/server'; -describe('getTelemetrySavedObject', () => { +describe.skip('getTelemetrySavedObject', () => { it('returns null when saved object not found', async () => { const params = getCallGetTelemetrySavedObjectParams({ savedObjectNotFound: true, diff --git a/src/plugins/telemetry_collection_manager/kibana.json b/src/plugins/telemetry_collection_manager/kibana_back.json similarity index 100% rename from src/plugins/telemetry_collection_manager/kibana.json rename to src/plugins/telemetry_collection_manager/kibana_back.json diff --git a/src/plugins/telemetry_management_section/kibana.json b/src/plugins/telemetry_management_section/kibana_back.json similarity index 100% rename from src/plugins/telemetry_management_section/kibana.json rename to src/plugins/telemetry_management_section/kibana_back.json diff --git a/src/plugins/telemetry_management_section/public/components/opt_in_example_flyout.test.tsx b/src/plugins/telemetry_management_section/public/components/opt_in_example_flyout.test.tsx index fe5e73a24489..75ad106a57e8 100644 --- a/src/plugins/telemetry_management_section/public/components/opt_in_example_flyout.test.tsx +++ b/src/plugins/telemetry_management_section/public/components/opt_in_example_flyout.test.tsx @@ -20,7 +20,7 @@ import React from 'react'; import { shallowWithIntl } from 'test_utils/enzyme_helpers'; import { OptInExampleFlyout } from './opt_in_example_flyout'; -describe('OptInDetailsComponent', () => { +describe.skip('OptInDetailsComponent', () => { it('renders as expected', () => { expect( shallowWithIntl( diff --git a/src/plugins/telemetry_management_section/public/components/opt_in_security_example_flyout.test.tsx b/src/plugins/telemetry_management_section/public/components/opt_in_security_example_flyout.test.tsx index c80d0daf5a69..a74a92646af9 100644 --- a/src/plugins/telemetry_management_section/public/components/opt_in_security_example_flyout.test.tsx +++ b/src/plugins/telemetry_management_section/public/components/opt_in_security_example_flyout.test.tsx @@ -20,7 +20,7 @@ import React from 'react'; import { shallowWithIntl } from 'test_utils/enzyme_helpers'; import { OptInSecurityExampleFlyout } from './opt_in_security_example_flyout'; -describe('security flyout renders as expected', () => { +describe.skip('security flyout renders as expected', () => { it('renders as expected', () => { expect(shallowWithIntl()).toMatchSnapshot(); }); diff --git a/src/plugins/telemetry_management_section/public/components/telemetry_management_section.test.tsx b/src/plugins/telemetry_management_section/public/components/telemetry_management_section.test.tsx index 6bdbbe730765..157269343082 100644 --- a/src/plugins/telemetry_management_section/public/components/telemetry_management_section.test.tsx +++ b/src/plugins/telemetry_management_section/public/components/telemetry_management_section.test.tsx @@ -23,7 +23,7 @@ import { TelemetryService } from '../../../telemetry/public/services'; import { coreMock } from '../../../../core/public/mocks'; import { render } from '@testing-library/react'; -describe('TelemetryManagementSectionComponent', () => { +describe.skip('TelemetryManagementSectionComponent', () => { const coreStart = coreMock.createStart(); const coreSetup = coreMock.createSetup(); diff --git a/src/plugins/usage_collection/server/routes/report_metrics.ts b/src/plugins/usage_collection/server/routes/report_metrics.ts index a72222968eab..7917e92ade3a 100644 --- a/src/plugins/usage_collection/server/routes/report_metrics.ts +++ b/src/plugins/usage_collection/server/routes/report_metrics.ts @@ -25,6 +25,7 @@ export function registerUiMetricRoute( router: IRouter, getSavedObjects: () => ISavedObjectsRepository | undefined ) { + /* router.post( { path: '/api/ui_metric/report', @@ -47,5 +48,5 @@ export function registerUiMetricRoute( return res.ok({ body: { status: 'fail' } }); } } - ); + );*/ } diff --git a/test/common/config.js b/test/common/config.js index 353453573929..1d14ba8235b2 100644 --- a/test/common/config.js +++ b/test/common/config.js @@ -51,11 +51,11 @@ export default function () { // Needed for async search functional tests to introduce a delay `--data.search.aggs.shardDelay.enabled=true`, `--security.showInsecureClusterWarning=false`, - '--telemetry.banner=false', - '--telemetry.optIn=false', + // '--telemetry.banner=false', + // '--telemetry.optIn=false', // These are *very* important to have them pointing to staging - '--telemetry.url=https://telemetry-staging.elastic.co/xpack/v2/send', - '--telemetry.optInStatusUrl=https://telemetry-staging.elastic.co/opt_in_status/v2/send', + // '--telemetry.url=https://telemetry-staging.elastic.co/xpack/v2/send', + // '--telemetry.optInStatusUrl=https://telemetry-staging.elastic.co/opt_in_status/v2/send', `--server.maxPayloadBytes=1679958`, // newsfeed mock service // `--plugin-path=${path.join(__dirname, 'fixtures', 'plugins', 'newsfeed')}`, diff --git a/test/functional/config.js b/test/functional/config.js index 5bef9896d17c..d22202935eca 100644 --- a/test/functional/config.js +++ b/test/functional/config.js @@ -50,7 +50,7 @@ export default async function ({ readConfigFile }) { serverArgs: [ ...commonConfig.get('kbnTestServer.serverArgs'), '--oss', - '--telemetry.optIn=false', + // '--telemetry.optIn=false', '--savedObjects.maxImportPayloadBytes=10485760', ], }, diff --git a/test/new_visualize_flow/config.ts b/test/new_visualize_flow/config.ts index 2b5816922282..d686d6f2fb38 100644 --- a/test/new_visualize_flow/config.ts +++ b/test/new_visualize_flow/config.ts @@ -34,7 +34,7 @@ export default async function ({ readConfigFile }: FtrConfigProviderContext) { serverArgs: [ ...commonConfig.get('kbnTestServer.serverArgs'), '--oss', - '--telemetry.optIn=false', + // '--telemetry.optIn=false', '--dashboard.allowByValueEmbeddables=true', ], }, From 5e6966c22a9b62e8608e8d77f78d4aa2407d2c21 Mon Sep 17 00:00:00 2001 From: Bishoy Boktor Date: Fri, 5 Feb 2021 23:00:43 +0000 Subject: [PATCH 2/3] Restore kibana file for data plugin --- src/plugins/data/kibana.json | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/plugins/data/kibana.json b/src/plugins/data/kibana.json index 466e5f75493b..9cb9b1745373 100644 --- a/src/plugins/data/kibana.json +++ b/src/plugins/data/kibana.json @@ -3,8 +3,16 @@ "version": "kibana", "server": true, "ui": true, - "requiredPlugins": ["expressions", "uiActions"], + "requiredPlugins": [ + "expressions", + "uiActions" + ], "optionalPlugins": ["usageCollection"], "extraPublicDirs": ["common", "common/utils/abort_utils"], - "requiredBundles": ["usageCollection", "kibanaUtils", "kibanaReact", "inspector"] + "requiredBundles": [ + "usageCollection", + "kibanaUtils", + "kibanaReact", + "inspector" + ] } From dd8bf7e4d7e0d0081100e875047d09c818759108 Mon Sep 17 00:00:00 2001 From: Bishoy Boktor Date: Sat, 6 Feb 2021 03:15:18 +0000 Subject: [PATCH 3/3] [PURIFY] Remove usageCollector and its reporting post reqs (#10) --- .i18nrc.json | 17 ++++------------- src/plugins/data/kibana.json | 14 +++----------- .../collectors/create_usage_collector.test.ts | 2 +- .../data/public/search/collectors/index.ts | 2 +- .../data/public/search/search_interceptor.ts | 4 ++-- .../data/public/search/search_service.ts | 17 +++++++++-------- .../{kibana.json => kibana_back.json} | 0 7 files changed, 20 insertions(+), 36 deletions(-) rename src/plugins/usage_collection/{kibana.json => kibana_back.json} (100%) diff --git a/.i18nrc.json b/.i18nrc.json index 68e38d3976a6..87a4a385862d 100644 --- a/.i18nrc.json +++ b/.i18nrc.json @@ -22,10 +22,7 @@ "interpreter": "src/legacy/core_plugins/interpreter", "kbn": "src/legacy/core_plugins/kibana", "kbnDocViews": "src/legacy/core_plugins/kbn_doc_views", - "management": [ - "src/legacy/core_plugins/management", - "src/plugins/management" - ], + "management": ["src/legacy/core_plugins/management", "src/plugins/management"], "maps_legacy": "src/plugins/maps_legacy", "indexPatternManagement": "src/plugins/index_pattern_management", "advancedSettings": "src/plugins/advanced_settings", @@ -42,10 +39,7 @@ "security": "src/plugins/security_oss", "server": "src/legacy/server", "statusPage": "src/legacy/core_plugins/status_page", - "telemetry": [ - "src/plugins/telemetry", - "src/plugins/telemetry_management_section" - ], + "telemetry": ["src/plugins/telemetry", "src/plugins/telemetry_management_section"], "tileMap": "src/plugins/tile_map", "timelion": ["src/plugins/timelion", "src/plugins/vis_type_timelion"], "uiActions": "src/plugins/ui_actions", @@ -60,11 +54,8 @@ "visTypeXy": "src/plugins/vis_type_xy", "visualizations": "src/plugins/visualizations", "visualize": "src/plugins/visualize", - "apmOss": "src/plugins/apm_oss", - "usageCollection": "src/plugins/usage_collection" + "apmOss": "src/plugins/apm_oss" }, - "exclude": [ - "src/legacy/ui/ui_render/ui_render_mixin.js" - ], + "exclude": ["src/legacy/ui/ui_render/ui_render_mixin.js"], "translations": [] } diff --git a/src/plugins/data/kibana.json b/src/plugins/data/kibana.json index 9cb9b1745373..769bf53080b3 100644 --- a/src/plugins/data/kibana.json +++ b/src/plugins/data/kibana.json @@ -3,16 +3,8 @@ "version": "kibana", "server": true, "ui": true, - "requiredPlugins": [ - "expressions", - "uiActions" - ], - "optionalPlugins": ["usageCollection"], + "requiredPlugins": ["expressions", "uiActions"], + "optionalPlugins": [], "extraPublicDirs": ["common", "common/utils/abort_utils"], - "requiredBundles": [ - "usageCollection", - "kibanaUtils", - "kibanaReact", - "inspector" - ] + "requiredBundles": ["kibanaUtils", "kibanaReact", "inspector"] } diff --git a/src/plugins/data/public/search/collectors/create_usage_collector.test.ts b/src/plugins/data/public/search/collectors/create_usage_collector.test.ts index 9cadb1e796ad..00fd2b46b248 100644 --- a/src/plugins/data/public/search/collectors/create_usage_collector.test.ts +++ b/src/plugins/data/public/search/collectors/create_usage_collector.test.ts @@ -25,7 +25,7 @@ import { SEARCH_EVENT_TYPE, SearchUsageCollector } from './types'; import { METRIC_TYPE } from '@kbn/analytics'; import { from } from 'rxjs'; -describe('Search Usage Collector', () => { +describe.skip('Search Usage Collector', () => { let mockCoreSetup: MockedKeys; let mockUsageCollectionSetup: Setup; let usageCollector: SearchUsageCollector; diff --git a/src/plugins/data/public/search/collectors/index.ts b/src/plugins/data/public/search/collectors/index.ts index afe127c00b5d..4e348e4ad102 100644 --- a/src/plugins/data/public/search/collectors/index.ts +++ b/src/plugins/data/public/search/collectors/index.ts @@ -17,5 +17,5 @@ * under the License. */ -export { createUsageCollector } from './create_usage_collector'; +// export { createUsageCollector } from './create_usage_collector'; export { SEARCH_EVENT_TYPE, SearchUsageCollector } from './types'; diff --git a/src/plugins/data/public/search/search_interceptor.ts b/src/plugins/data/public/search/search_interceptor.ts index 2e42635a7f81..ed0e35d8ede6 100644 --- a/src/plugins/data/public/search/search_interceptor.ts +++ b/src/plugins/data/public/search/search_interceptor.ts @@ -29,7 +29,7 @@ import { ISearchOptions, ES_SEARCH_STRATEGY, } from '../../common'; -import { SearchUsageCollector } from './collectors'; +// import { SearchUsageCollector } from './collectors'; import { SearchTimeoutError, PainlessError, isPainlessError, TimeoutErrorMode } from './errors'; import { toMountPoint } from '../../../kibana_react/public'; @@ -38,7 +38,7 @@ export interface SearchInterceptorDeps { uiSettings: CoreSetup['uiSettings']; startServices: Promise<[CoreStart, any, unknown]>; toasts: ToastsSetup; - usageCollector?: SearchUsageCollector; + // usageCollector?: SearchUsageCollector; } export class SearchInterceptor { diff --git a/src/plugins/data/public/search/search_service.ts b/src/plugins/data/public/search/search_service.ts index 2d582b30bcd1..86e299745a92 100644 --- a/src/plugins/data/public/search/search_service.ts +++ b/src/plugins/data/public/search/search_service.ts @@ -36,8 +36,8 @@ import { getCallMsearch } from './legacy'; import { AggsService, AggsStartDependencies } from './aggs'; import { IndexPatternsContract } from '../index_patterns/index_patterns'; import { ISearchInterceptor, SearchInterceptor } from './search_interceptor'; -import { SearchUsageCollector, createUsageCollector } from './collectors'; -import { UsageCollectionSetup } from '../../../usage_collection/public'; +// import { SearchUsageCollector, createUsageCollector } from './collectors'; +// import { UsageCollectionSetup } from '../../../usage_collection/public'; import { esdsl, esRawResponse } from './expressions'; import { ExpressionsSetup } from '../../../expressions/public'; import { ConfigSchema } from '../../config'; @@ -50,7 +50,7 @@ import { aggShardDelay } from '../../common/search/aggs/buckets/shard_delay_fn'; /** @internal */ export interface SearchServiceSetupDependencies { expressions: ExpressionsSetup; - usageCollection?: UsageCollectionSetup; + // usageCollection?: UsageCollectionSetup; } /** @internal */ @@ -63,15 +63,16 @@ export class SearchService implements Plugin { private readonly aggsService = new AggsService(); private readonly searchSourceService = new SearchSourceService(); private searchInterceptor!: ISearchInterceptor; - private usageCollector?: SearchUsageCollector; + // private usageCollector?: SearchUsageCollector; constructor(private initializerContext: PluginInitializerContext) {} public setup( { http, getStartServices, notifications, uiSettings }: CoreSetup, - { expressions, usageCollection }: SearchServiceSetupDependencies + // { expressions, usageCollection }: SearchServiceSetupDependencies + { expressions }: SearchServiceSetupDependencies ): ISearchSetup { - this.usageCollector = createUsageCollector(getStartServices, usageCollection); + // this.usageCollector = createUsageCollector(getStartServices, usageCollection); /** * A global object that intercepts all searches and provides convenience methods for cancelling @@ -82,7 +83,7 @@ export class SearchService implements Plugin { http, uiSettings, startServices: getStartServices(), - usageCollector: this.usageCollector!, + usageCollector: undefined, // this.usageCollector!, }); expressions.registerFunction(esdsl); @@ -100,7 +101,7 @@ export class SearchService implements Plugin { return { aggs, - usageCollector: this.usageCollector!, + usageCollector: undefined, // this.usageCollector!, __enhance: (enhancements: SearchEnhancements) => { this.searchInterceptor = enhancements.searchInterceptor; }, diff --git a/src/plugins/usage_collection/kibana.json b/src/plugins/usage_collection/kibana_back.json similarity index 100% rename from src/plugins/usage_collection/kibana.json rename to src/plugins/usage_collection/kibana_back.json