@@ -148,7 +160,7 @@ export class TelemetryForm extends Component {
@@ -156,7 +168,7 @@ export class TelemetryForm extends Component {
diff --git a/x-pack/legacy/plugins/telemetry/public/components/telemetry_form.test.js b/src/legacy/core_plugins/telemetry/public/components/telemetry_form.test.js
similarity index 52%
rename from x-pack/legacy/plugins/telemetry/public/components/telemetry_form.test.js
rename to src/legacy/core_plugins/telemetry/public/components/telemetry_form.test.js
index 4df9cc0da169..4d2c1dec2717 100644
--- a/x-pack/legacy/plugins/telemetry/public/components/telemetry_form.test.js
+++ b/src/legacy/core_plugins/telemetry/public/components/telemetry_form.test.js
@@ -1,14 +1,27 @@
/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License;
- * you may not use this file except in compliance with the Elastic License.
+ * Licensed to Elasticsearch B.V. under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch B.V. licenses this file to you under
+ * the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
import '../services/telemetry_opt_in.test.mocks';
import React from 'react';
import { shallowWithIntl } from 'test_utils/enzyme_helpers';
import { TelemetryForm } from './telemetry_form';
-import { TelemetryOptInProvider } from '../services/telemetry_opt_in';
+import { TelemetryOptInProvider } from '../services';
const buildTelemetryOptInProvider = () => {
const mockHttp = {
diff --git a/x-pack/legacy/plugins/telemetry/public/hacks/__tests__/fetch_telemetry.js b/src/legacy/core_plugins/telemetry/public/hacks/__tests__/fetch_telemetry.js
similarity index 52%
rename from x-pack/legacy/plugins/telemetry/public/hacks/__tests__/fetch_telemetry.js
rename to src/legacy/core_plugins/telemetry/public/hacks/__tests__/fetch_telemetry.js
index 26269ef97fa6..8fb8b6e44f0e 100644
--- a/x-pack/legacy/plugins/telemetry/public/hacks/__tests__/fetch_telemetry.js
+++ b/src/legacy/core_plugins/telemetry/public/hacks/__tests__/fetch_telemetry.js
@@ -1,7 +1,20 @@
/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License;
- * you may not use this file except in compliance with the Elastic License.
+ * Licensed to Elasticsearch B.V. under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch B.V. licenses this file to you under
+ * the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
import expect from '@kbn/expect';
diff --git a/src/legacy/core_plugins/telemetry/public/hacks/__tests__/telemetry.js b/src/legacy/core_plugins/telemetry/public/hacks/__tests__/telemetry.js
new file mode 100644
index 000000000000..374927486867
--- /dev/null
+++ b/src/legacy/core_plugins/telemetry/public/hacks/__tests__/telemetry.js
@@ -0,0 +1,28 @@
+/*
+ * Licensed to Elasticsearch B.V. under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch B.V. licenses this file to you under
+ * the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import { uiModules } from 'ui/modules';
+
+// This overrides settings for other UI tests
+uiModules.get('kibana')
+ // disable stat reporting while running tests,
+ // MockInjector used in these tests is not impacted
+ .constant('telemetryEnabled', false)
+ .constant('telemetryOptedIn', null)
+ .constant('telemetryUrl', 'not.a.valid.url.0');
diff --git a/src/legacy/core_plugins/telemetry/public/hacks/fetch_telemetry.js b/src/legacy/core_plugins/telemetry/public/hacks/fetch_telemetry.js
new file mode 100644
index 000000000000..43ec0c2ce571
--- /dev/null
+++ b/src/legacy/core_plugins/telemetry/public/hacks/fetch_telemetry.js
@@ -0,0 +1,39 @@
+/*
+ * Licensed to Elasticsearch B.V. under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch B.V. licenses this file to you under
+ * the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import uiChrome from 'ui/chrome';
+import moment from 'moment';
+
+/**
+ * Fetch Telemetry data by calling the Kibana API.
+ *
+ * @param {Object} $http The HTTP handler
+ * @param {String} basePath The base URI
+ * @param {Function} _moment moment.js, but injectable for tests
+ * @return {Promise} An array of cluster Telemetry objects.
+ */
+export function fetchTelemetry($http, { basePath = uiChrome.getBasePath(), _moment = moment, unencrypted = false } = { }) {
+ return $http.post(`${basePath}/api/telemetry/v2/clusters/_stats`, {
+ unencrypted,
+ timeRange: {
+ min: _moment().subtract(20, 'minutes').toISOString(),
+ max: _moment().toISOString()
+ }
+ });
+}
diff --git a/x-pack/legacy/plugins/telemetry/public/hacks/telemetry.js b/src/legacy/core_plugins/telemetry/public/hacks/telemetry.js
similarity index 79%
rename from x-pack/legacy/plugins/telemetry/public/hacks/telemetry.js
rename to src/legacy/core_plugins/telemetry/public/hacks/telemetry.js
index 168bb6d7eec9..4febd8cd9e9a 100644
--- a/x-pack/legacy/plugins/telemetry/public/hacks/telemetry.js
+++ b/src/legacy/core_plugins/telemetry/public/hacks/telemetry.js
@@ -1,7 +1,20 @@
/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License;
- * you may not use this file except in compliance with the Elastic License.
+ * Licensed to Elasticsearch B.V. under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch B.V. licenses this file to you under
+ * the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
import {
diff --git a/x-pack/legacy/plugins/telemetry/public/hacks/telemetry.test.js b/src/legacy/core_plugins/telemetry/public/hacks/telemetry.test.js
similarity index 92%
rename from x-pack/legacy/plugins/telemetry/public/hacks/telemetry.test.js
rename to src/legacy/core_plugins/telemetry/public/hacks/telemetry.test.js
index d08d89d73801..ffb72701f835 100644
--- a/x-pack/legacy/plugins/telemetry/public/hacks/telemetry.test.js
+++ b/src/legacy/core_plugins/telemetry/public/hacks/telemetry.test.js
@@ -1,7 +1,20 @@
/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License;
- * you may not use this file except in compliance with the Elastic License.
+ * Licensed to Elasticsearch B.V. under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch B.V. licenses this file to you under
+ * the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
import { Telemetry } from './telemetry';
diff --git a/src/legacy/core_plugins/telemetry/public/hacks/telemetry_init.ts b/src/legacy/core_plugins/telemetry/public/hacks/telemetry_init.ts
new file mode 100644
index 000000000000..364871380a52
--- /dev/null
+++ b/src/legacy/core_plugins/telemetry/public/hacks/telemetry_init.ts
@@ -0,0 +1,45 @@
+/*
+ * Licensed to Elasticsearch B.V. under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch B.V. licenses this file to you under
+ * the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import { npStart } from 'ui/new_platform';
+// @ts-ignore
+import { uiModules } from 'ui/modules';
+import { isUnauthenticated } from '../services';
+// @ts-ignore
+import { Telemetry } from './telemetry';
+// @ts-ignore
+import { fetchTelemetry } from './fetch_telemetry';
+
+function telemetryInit($injector: any) {
+ const $http = $injector.get('$http');
+
+ const telemetryEnabled = npStart.core.injectedMetadata.getInjectedVar('telemetryEnabled');
+
+ if (telemetryEnabled) {
+ // no telemetry for non-logged in users
+ if (isUnauthenticated()) {
+ return;
+ }
+
+ const sender = new Telemetry($injector, () => fetchTelemetry($http));
+ sender.start();
+ }
+}
+
+uiModules.get('telemetry/hacks').run(telemetryInit);
diff --git a/src/legacy/core_plugins/telemetry/public/hacks/telemetry_opt_in.js b/src/legacy/core_plugins/telemetry/public/hacks/telemetry_opt_in.js
new file mode 100644
index 000000000000..4e53c7ecd703
--- /dev/null
+++ b/src/legacy/core_plugins/telemetry/public/hacks/telemetry_opt_in.js
@@ -0,0 +1,24 @@
+/*
+ * Licensed to Elasticsearch B.V. under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch B.V. licenses this file to you under
+ * the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import { uiModules } from 'ui/modules';
+
+import { injectBanner } from './welcome_banner';
+
+uiModules.get('telemetry/hacks').run(injectBanner);
diff --git a/x-pack/legacy/plugins/telemetry/public/hacks/welcome_banner/click_banner.js b/src/legacy/core_plugins/telemetry/public/hacks/welcome_banner/click_banner.js
similarity index 60%
rename from x-pack/legacy/plugins/telemetry/public/hacks/welcome_banner/click_banner.js
rename to src/legacy/core_plugins/telemetry/public/hacks/welcome_banner/click_banner.js
index f337a8025e01..a20c99b7eee5 100644
--- a/x-pack/legacy/plugins/telemetry/public/hacks/welcome_banner/click_banner.js
+++ b/src/legacy/core_plugins/telemetry/public/hacks/welcome_banner/click_banner.js
@@ -1,7 +1,20 @@
/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License;
- * you may not use this file except in compliance with the Elastic License.
+ * Licensed to Elasticsearch B.V. under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch B.V. licenses this file to you under
+ * the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
import React from 'react';
@@ -41,7 +54,7 @@ export async function clickBanner(
_toastNotifications.addDanger({
title: (
),
@@ -49,13 +62,13 @@ export async function clickBanner(
diff --git a/x-pack/legacy/plugins/telemetry/public/hacks/welcome_banner/click_banner.test.js b/src/legacy/core_plugins/telemetry/public/hacks/welcome_banner/click_banner.test.js
similarity index 80%
rename from x-pack/legacy/plugins/telemetry/public/hacks/welcome_banner/click_banner.test.js
rename to src/legacy/core_plugins/telemetry/public/hacks/welcome_banner/click_banner.test.js
index 751a8f5498ee..9b17d51d6ea6 100644
--- a/x-pack/legacy/plugins/telemetry/public/hacks/welcome_banner/click_banner.test.js
+++ b/src/legacy/core_plugins/telemetry/public/hacks/welcome_banner/click_banner.test.js
@@ -1,7 +1,20 @@
/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License;
- * you may not use this file except in compliance with the Elastic License.
+ * Licensed to Elasticsearch B.V. under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch B.V. licenses this file to you under
+ * the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
import { mockInjectedMetadata } from '../../services/telemetry_opt_in.test.mocks';
diff --git a/x-pack/legacy/plugins/telemetry/public/hacks/welcome_banner/handle_old_settings.js b/src/legacy/core_plugins/telemetry/public/hacks/welcome_banner/handle_old_settings.js
similarity index 66%
rename from x-pack/legacy/plugins/telemetry/public/hacks/welcome_banner/handle_old_settings.js
rename to src/legacy/core_plugins/telemetry/public/hacks/welcome_banner/handle_old_settings.js
index 4188676bad1e..31091e195205 100644
--- a/x-pack/legacy/plugins/telemetry/public/hacks/welcome_banner/handle_old_settings.js
+++ b/src/legacy/core_plugins/telemetry/public/hacks/welcome_banner/handle_old_settings.js
@@ -1,7 +1,20 @@
/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License;
- * you may not use this file except in compliance with the Elastic License.
+ * Licensed to Elasticsearch B.V. under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch B.V. licenses this file to you under
+ * the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
import { CONFIG_TELEMETRY } from '../../../common/constants';
diff --git a/x-pack/legacy/plugins/telemetry/public/hacks/welcome_banner/handle_old_settings.test.js b/src/legacy/core_plugins/telemetry/public/hacks/welcome_banner/handle_old_settings.test.js
similarity index 89%
rename from x-pack/legacy/plugins/telemetry/public/hacks/welcome_banner/handle_old_settings.test.js
rename to src/legacy/core_plugins/telemetry/public/hacks/welcome_banner/handle_old_settings.test.js
index 40e3bb042fa8..fd21a5122b59 100644
--- a/x-pack/legacy/plugins/telemetry/public/hacks/welcome_banner/handle_old_settings.test.js
+++ b/src/legacy/core_plugins/telemetry/public/hacks/welcome_banner/handle_old_settings.test.js
@@ -1,7 +1,20 @@
/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License;
- * you may not use this file except in compliance with the Elastic License.
+ * Licensed to Elasticsearch B.V. under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch B.V. licenses this file to you under
+ * the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
import { mockInjectedMetadata } from '../../services/telemetry_opt_in.test.mocks';
diff --git a/src/legacy/core_plugins/telemetry/public/hacks/welcome_banner/index.js b/src/legacy/core_plugins/telemetry/public/hacks/welcome_banner/index.js
new file mode 100644
index 000000000000..ffb0e88c60a0
--- /dev/null
+++ b/src/legacy/core_plugins/telemetry/public/hacks/welcome_banner/index.js
@@ -0,0 +1,20 @@
+/*
+ * Licensed to Elasticsearch B.V. under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch B.V. licenses this file to you under
+ * the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+export { injectBanner } from './inject_banner';
diff --git a/x-pack/legacy/plugins/telemetry/public/hacks/welcome_banner/inject_banner.js b/src/legacy/core_plugins/telemetry/public/hacks/welcome_banner/inject_banner.js
similarity index 64%
rename from x-pack/legacy/plugins/telemetry/public/hacks/welcome_banner/inject_banner.js
rename to src/legacy/core_plugins/telemetry/public/hacks/welcome_banner/inject_banner.js
index 384086dfed3c..13417a137e6c 100644
--- a/x-pack/legacy/plugins/telemetry/public/hacks/welcome_banner/inject_banner.js
+++ b/src/legacy/core_plugins/telemetry/public/hacks/welcome_banner/inject_banner.js
@@ -1,15 +1,28 @@
/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License;
- * you may not use this file except in compliance with the Elastic License.
+ * Licensed to Elasticsearch B.V. under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch B.V. licenses this file to you under
+ * the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
import chrome from 'ui/chrome';
-import { Path } from 'plugins/xpack_main/services/path';
+
import { fetchTelemetry } from '../fetch_telemetry';
import { renderBanner } from './render_banner';
import { shouldShowBanner } from './should_show_banner';
-import { TelemetryOptInProvider } from '../../services/telemetry_opt_in';
+import { TelemetryOptInProvider, isUnauthenticated } from '../../services';
import { npStart } from 'ui/new_platform';
/**
@@ -26,7 +39,7 @@ async function asyncInjectBanner($injector) {
const config = $injector.get('config');
// and no banner for non-logged in users
- if (Path.isUnauthenticated()) {
+ if (isUnauthenticated()) {
return;
}
diff --git a/x-pack/legacy/plugins/telemetry/public/hacks/welcome_banner/render_banner.js b/src/legacy/core_plugins/telemetry/public/hacks/welcome_banner/render_banner.js
similarity index 51%
rename from x-pack/legacy/plugins/telemetry/public/hacks/welcome_banner/render_banner.js
rename to src/legacy/core_plugins/telemetry/public/hacks/welcome_banner/render_banner.js
index 9143d1306931..835d1a8cba62 100644
--- a/x-pack/legacy/plugins/telemetry/public/hacks/welcome_banner/render_banner.js
+++ b/src/legacy/core_plugins/telemetry/public/hacks/welcome_banner/render_banner.js
@@ -1,7 +1,20 @@
/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License;
- * you may not use this file except in compliance with the Elastic License.
+ * Licensed to Elasticsearch B.V. under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch B.V. licenses this file to you under
+ * the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
import React from 'react';
diff --git a/src/legacy/core_plugins/telemetry/public/hacks/welcome_banner/render_banner.test.js b/src/legacy/core_plugins/telemetry/public/hacks/welcome_banner/render_banner.test.js
new file mode 100644
index 000000000000..9db5103cc9b2
--- /dev/null
+++ b/src/legacy/core_plugins/telemetry/public/hacks/welcome_banner/render_banner.test.js
@@ -0,0 +1,44 @@
+/*
+ * Licensed to Elasticsearch B.V. under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch B.V. licenses this file to you under
+ * the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import '../../services/telemetry_opt_in.test.mocks';
+import { renderBanner } from './render_banner';
+
+describe('render_banner', () => {
+
+ it('adds a banner to banners with priority of 10000', () => {
+ const bannerID = 'brucer-banner';
+
+ const telemetryOptInProvider = { setBannerId: jest.fn() };
+ const banners = { add: jest.fn().mockReturnValue(bannerID) };
+ const fetchTelemetry = jest.fn();
+
+ renderBanner(telemetryOptInProvider, fetchTelemetry, { _banners: banners });
+
+ expect(banners.add).toBeCalledTimes(1);
+ expect(fetchTelemetry).toBeCalledTimes(0);
+ expect(telemetryOptInProvider.setBannerId).toBeCalledWith(bannerID);
+
+ const bannerConfig = banners.add.mock.calls[0][0];
+
+ expect(bannerConfig.component).not.toBe(undefined);
+ expect(bannerConfig.priority).toBe(10000);
+ });
+
+});
diff --git a/src/legacy/core_plugins/telemetry/public/hacks/welcome_banner/should_show_banner.js b/src/legacy/core_plugins/telemetry/public/hacks/welcome_banner/should_show_banner.js
new file mode 100644
index 000000000000..47c6e58422e4
--- /dev/null
+++ b/src/legacy/core_plugins/telemetry/public/hacks/welcome_banner/should_show_banner.js
@@ -0,0 +1,33 @@
+/*
+ * Licensed to Elasticsearch B.V. under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch B.V. licenses this file to you under
+ * the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import { handleOldSettings } from './handle_old_settings';
+
+/**
+ * Determine if the banner should be displayed.
+ *
+ * This method can have side-effects related to deprecated config settings.
+ *
+ * @param {Object} config The advanced settings config object.
+ * @param {Object} _handleOldSettings handleOldSettings function, but overridable for tests.
+ * @return {Boolean} {@code true} if the banner should be displayed. {@code false} otherwise.
+ */
+export async function shouldShowBanner(telemetryOptInProvider, config, { _handleOldSettings = handleOldSettings } = {}) {
+ return telemetryOptInProvider.getOptIn() === null && await _handleOldSettings(config, telemetryOptInProvider);
+}
diff --git a/x-pack/legacy/plugins/telemetry/public/hacks/welcome_banner/should_show_banner.test.js b/src/legacy/core_plugins/telemetry/public/hacks/welcome_banner/should_show_banner.test.js
similarity index 73%
rename from x-pack/legacy/plugins/telemetry/public/hacks/welcome_banner/should_show_banner.test.js
rename to src/legacy/core_plugins/telemetry/public/hacks/welcome_banner/should_show_banner.test.js
index 1bfe7e954738..19e7ccbe6186 100644
--- a/x-pack/legacy/plugins/telemetry/public/hacks/welcome_banner/should_show_banner.test.js
+++ b/src/legacy/core_plugins/telemetry/public/hacks/welcome_banner/should_show_banner.test.js
@@ -1,7 +1,20 @@
/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License;
- * you may not use this file except in compliance with the Elastic License.
+ * Licensed to Elasticsearch B.V. under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch B.V. licenses this file to you under
+ * the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
import { mockInjectedMetadata } from '../../services/telemetry_opt_in.test.mocks';
@@ -10,7 +23,7 @@ import sinon from 'sinon';
import { CONFIG_TELEMETRY } from '../../../common/constants';
import { shouldShowBanner } from './should_show_banner';
-import { TelemetryOptInProvider } from '../../services/telemetry_opt_in';
+import { TelemetryOptInProvider } from '../../services';
const getMockInjector = () => {
const get = sinon.stub();
diff --git a/src/legacy/core_plugins/telemetry/public/services/index.ts b/src/legacy/core_plugins/telemetry/public/services/index.ts
new file mode 100644
index 000000000000..8b02f8ce4c5b
--- /dev/null
+++ b/src/legacy/core_plugins/telemetry/public/services/index.ts
@@ -0,0 +1,21 @@
+/*
+ * Licensed to Elasticsearch B.V. under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch B.V. licenses this file to you under
+ * the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+export { TelemetryOptInProvider } from './telemetry_opt_in';
+export { isUnauthenticated } from './path';
diff --git a/src/legacy/core_plugins/telemetry/public/services/path.ts b/src/legacy/core_plugins/telemetry/public/services/path.ts
new file mode 100644
index 000000000000..4af545e982ea
--- /dev/null
+++ b/src/legacy/core_plugins/telemetry/public/services/path.ts
@@ -0,0 +1,25 @@
+/*
+ * Licensed to Elasticsearch B.V. under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch B.V. licenses this file to you under
+ * the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import chrome from 'ui/chrome';
+
+export function isUnauthenticated() {
+ const path = (chrome as any).removeBasePath(window.location.pathname);
+ return path === '/login' || path === '/logout' || path === '/logged_out' || path === '/status';
+}
diff --git a/x-pack/legacy/plugins/telemetry/public/services/telemetry_opt_in.test.js b/src/legacy/core_plugins/telemetry/public/services/telemetry_opt_in.test.js
similarity index 75%
rename from x-pack/legacy/plugins/telemetry/public/services/telemetry_opt_in.test.js
rename to src/legacy/core_plugins/telemetry/public/services/telemetry_opt_in.test.js
index 5b93f84eabf4..0034fa443823 100644
--- a/x-pack/legacy/plugins/telemetry/public/services/telemetry_opt_in.test.js
+++ b/src/legacy/core_plugins/telemetry/public/services/telemetry_opt_in.test.js
@@ -1,8 +1,22 @@
/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License;
- * you may not use this file except in compliance with the Elastic License.
+ * Licensed to Elasticsearch B.V. under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch B.V. licenses this file to you under
+ * the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
+
import { mockInjectedMetadata } from './telemetry_opt_in.test.mocks';
import { TelemetryOptInProvider } from './telemetry_opt_in';
diff --git a/src/legacy/core_plugins/telemetry/public/services/telemetry_opt_in.test.mocks.js b/src/legacy/core_plugins/telemetry/public/services/telemetry_opt_in.test.mocks.js
new file mode 100644
index 000000000000..f98f5e16e00c
--- /dev/null
+++ b/src/legacy/core_plugins/telemetry/public/services/telemetry_opt_in.test.mocks.js
@@ -0,0 +1,50 @@
+/*
+ * Licensed to Elasticsearch B.V. under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch B.V. licenses this file to you under
+ * the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import {
+ injectedMetadataServiceMock,
+ notificationServiceMock,
+ overlayServiceMock,
+} from '../../../../../core/public/mocks';
+const injectedMetadataMock = injectedMetadataServiceMock.createStartContract();
+
+export function mockInjectedMetadata({ telemetryOptedIn }) {
+ const mockGetInjectedVar = jest.fn().mockImplementation((key) => {
+ switch (key) {
+ case 'telemetryOptedIn': return telemetryOptedIn;
+ default: throw new Error(`unexpected injectedVar ${key}`);
+ }
+ });
+
+ injectedMetadataMock.getInjectedVar = mockGetInjectedVar;
+}
+
+jest.doMock('ui/new_platform', () => ({
+ npSetup: {
+ core: {
+ notifications: notificationServiceMock.createSetupContract(),
+ }
+ },
+ npStart: {
+ core: {
+ injectedMetadata: injectedMetadataMock,
+ overlays: overlayServiceMock.createStartContract(),
+ },
+ },
+}));
diff --git a/src/legacy/core_plugins/kibana/public/home/telemetry_opt_in.js b/src/legacy/core_plugins/telemetry/public/services/telemetry_opt_in.ts
similarity index 75%
rename from src/legacy/core_plugins/kibana/public/home/telemetry_opt_in.js
rename to src/legacy/core_plugins/telemetry/public/services/telemetry_opt_in.ts
index 274820844da4..f4462ffea7a3 100644
--- a/src/legacy/core_plugins/kibana/public/home/telemetry_opt_in.js
+++ b/src/legacy/core_plugins/telemetry/public/services/telemetry_opt_in.ts
@@ -23,16 +23,20 @@ import { toastNotifications } from 'ui/notify';
import { npStart } from 'ui/new_platform';
import { i18n } from '@kbn/i18n';
-export function TelemetryOptInProvider($injector, chrome) {
- let currentOptInStatus = npStart.core.injectedMetadata.getInjectedVar('telemetryOptedIn');
- let bannerId = null;
+let bannerId: string | null = null;
+let currentOptInStatus = false;
+
+export function TelemetryOptInProvider($injector: any, chrome: any) {
+ currentOptInStatus = npStart.core.injectedMetadata.getInjectedVar('telemetryOptedIn') as boolean;
setCanTrackUiMetrics(currentOptInStatus);
const provider = {
getBannerId: () => bannerId,
getOptIn: () => currentOptInStatus,
- setBannerId(id) { bannerId = id; },
- setOptIn: async (enabled) => {
+ setBannerId(id: string) {
+ bannerId = id;
+ },
+ setOptIn: async (enabled: boolean) => {
setCanTrackUiMetrics(enabled);
const $http = $injector.get('$http');
@@ -41,10 +45,10 @@ export function TelemetryOptInProvider($injector, chrome) {
currentOptInStatus = enabled;
} catch (error) {
toastNotifications.addError(error, {
- title: i18n.translate('kbn.home.telemetry.optInErrorToastTitle', {
+ title: i18n.translate('telemetry.optInErrorToastTitle', {
defaultMessage: 'Error',
}),
- toastMessage: i18n.translate('kbn.home.telemetry.optInErrorToastText', {
+ toastMessage: i18n.translate('telemetry.optInErrorToastText', {
defaultMessage: 'An error occured while trying to set the usage statistics preference.',
}),
});
@@ -58,11 +62,13 @@ export function TelemetryOptInProvider($injector, chrome) {
return $http.post(chrome.addBasePath(`/api/telemetry/v2/clusters/_stats`), {
unencrypted: true,
timeRange: {
- min: moment().subtract(20, 'minutes').toISOString(),
- max: moment().toISOString()
- }
+ min: moment()
+ .subtract(20, 'minutes')
+ .toISOString(),
+ max: moment().toISOString(),
+ },
});
- }
+ },
};
return provider;
diff --git a/src/legacy/core_plugins/telemetry/public/views/management/index.js b/src/legacy/core_plugins/telemetry/public/views/management/index.js
new file mode 100644
index 000000000000..2e9f064ec80d
--- /dev/null
+++ b/src/legacy/core_plugins/telemetry/public/views/management/index.js
@@ -0,0 +1,20 @@
+/*
+ * Licensed to Elasticsearch B.V. under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch B.V. licenses this file to you under
+ * the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import './management';
diff --git a/src/legacy/core_plugins/telemetry/public/views/management/management.js b/src/legacy/core_plugins/telemetry/public/views/management/management.js
new file mode 100644
index 000000000000..9f6e96c925cd
--- /dev/null
+++ b/src/legacy/core_plugins/telemetry/public/views/management/management.js
@@ -0,0 +1,42 @@
+/*
+ * Licensed to Elasticsearch B.V. under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch B.V. licenses this file to you under
+ * the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+import React from 'react';
+import routes from 'ui/routes';
+
+import { registerSettingsComponent, PAGE_FOOTER_COMPONENT } from 'ui/management';
+import { TelemetryOptInProvider } from '../../services';
+import { TelemetryForm } from '../../components';
+
+routes.defaults(/\/management/, {
+ resolve: {
+ telemetryManagementSection: function (Private) {
+ const telemetryOptInProvider = Private(TelemetryOptInProvider);
+
+ const Component = (props) => (
+
+ );
+
+ registerSettingsComponent(PAGE_FOOTER_COMPONENT, Component, true);
+ }
+ }
+});
diff --git a/src/legacy/core_plugins/telemetry/server/collection_manager.ts b/src/legacy/core_plugins/telemetry/server/collection_manager.ts
new file mode 100644
index 000000000000..fef0a9b0f9f4
--- /dev/null
+++ b/src/legacy/core_plugins/telemetry/server/collection_manager.ts
@@ -0,0 +1,49 @@
+/*
+ * Licensed to Elasticsearch B.V. under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch B.V. licenses this file to you under
+ * the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+class TelemetryCollectionManager {
+ private getterMethod?: any;
+ private collectionTitle?: string;
+ private getterMethodPriority = 0;
+
+ public setStatsGetter = (statsGetter: any, title: string, priority = 0) => {
+ if (priority >= this.getterMethodPriority) {
+ this.getterMethod = statsGetter;
+ this.collectionTitle = title;
+ this.getterMethodPriority = priority;
+ }
+ };
+
+ getCollectionTitle = () => {
+ return this.collectionTitle;
+ };
+
+ public getStatsGetter = () => {
+ if (!this.getterMethod) {
+ throw Error('Stats getter method not set.');
+ }
+ return {
+ getStats: this.getterMethod,
+ priority: this.getterMethodPriority,
+ title: this.collectionTitle,
+ };
+ };
+}
+
+export const telemetryCollectionManager = new TelemetryCollectionManager();
diff --git a/x-pack/legacy/plugins/telemetry/server/collectors/encryption/encrypt.test.ts b/src/legacy/core_plugins/telemetry/server/collectors/encryption/encrypt.test.ts
similarity index 53%
rename from x-pack/legacy/plugins/telemetry/server/collectors/encryption/encrypt.test.ts
rename to src/legacy/core_plugins/telemetry/server/collectors/encryption/encrypt.test.ts
index ed13b5569d98..4a4ba7aa1f32 100644
--- a/x-pack/legacy/plugins/telemetry/server/collectors/encryption/encrypt.test.ts
+++ b/src/legacy/core_plugins/telemetry/server/collectors/encryption/encrypt.test.ts
@@ -1,7 +1,20 @@
/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License;
- * you may not use this file except in compliance with the Elastic License.
+ * Licensed to Elasticsearch B.V. under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch B.V. licenses this file to you under
+ * the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
import { telemetryJWKS } from './telemetry_jwks';
diff --git a/src/legacy/core_plugins/telemetry/server/collectors/encryption/encrypt.ts b/src/legacy/core_plugins/telemetry/server/collectors/encryption/encrypt.ts
new file mode 100644
index 000000000000..c20f4b768b7d
--- /dev/null
+++ b/src/legacy/core_plugins/telemetry/server/collectors/encryption/encrypt.ts
@@ -0,0 +1,32 @@
+/*
+ * Licensed to Elasticsearch B.V. under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch B.V. licenses this file to you under
+ * the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import { createRequestEncryptor } from '@elastic/request-crypto';
+import { telemetryJWKS } from './telemetry_jwks';
+
+export function getKID(isProd = false): string {
+ return isProd ? 'kibana' : 'kibana_dev';
+}
+
+export async function encryptTelemetry(payload: any, isProd = false): Promise {
+ const kid = getKID(isProd);
+ const encryptor = await createRequestEncryptor(telemetryJWKS);
+ const clusters = [].concat(payload);
+ return Promise.all(clusters.map((cluster: any) => encryptor.encrypt(kid, cluster)));
+}
diff --git a/src/legacy/core_plugins/telemetry/server/collectors/encryption/index.ts b/src/legacy/core_plugins/telemetry/server/collectors/encryption/index.ts
new file mode 100644
index 000000000000..08636d45861e
--- /dev/null
+++ b/src/legacy/core_plugins/telemetry/server/collectors/encryption/index.ts
@@ -0,0 +1,20 @@
+/*
+ * Licensed to Elasticsearch B.V. under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch B.V. licenses this file to you under
+ * the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+export { encryptTelemetry } from './encrypt';
diff --git a/x-pack/legacy/plugins/telemetry/server/collectors/encryption/telemetry_jwks.ts b/src/legacy/core_plugins/telemetry/server/collectors/encryption/telemetry_jwks.ts
similarity index 57%
rename from x-pack/legacy/plugins/telemetry/server/collectors/encryption/telemetry_jwks.ts
rename to src/legacy/core_plugins/telemetry/server/collectors/encryption/telemetry_jwks.ts
index b4983ad2d4db..8615ba2f9d60 100644
--- a/x-pack/legacy/plugins/telemetry/server/collectors/encryption/telemetry_jwks.ts
+++ b/src/legacy/core_plugins/telemetry/server/collectors/encryption/telemetry_jwks.ts
@@ -1,7 +1,20 @@
/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License;
- * you may not use this file except in compliance with the Elastic License.
+ * Licensed to Elasticsearch B.V. under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch B.V. licenses this file to you under
+ * the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
import { PublicJWKS } from '@elastic/request-crypto';
diff --git a/src/legacy/core_plugins/telemetry/server/collectors/index.ts b/src/legacy/core_plugins/telemetry/server/collectors/index.ts
new file mode 100644
index 000000000000..0bc1d50fab1b
--- /dev/null
+++ b/src/legacy/core_plugins/telemetry/server/collectors/index.ts
@@ -0,0 +1,23 @@
+/*
+ * Licensed to Elasticsearch B.V. under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch B.V. licenses this file to you under
+ * the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+export { encryptTelemetry } from './encryption';
+export { createTelemetryUsageCollector } from './usage';
+export { createUiMetricUsageCollector } from './ui_metric';
+export { createLocalizationUsageCollector } from './localization';
diff --git a/src/legacy/core_plugins/telemetry/server/collectors/localization/file_integrity.test.mocks.ts b/src/legacy/core_plugins/telemetry/server/collectors/localization/file_integrity.test.mocks.ts
new file mode 100644
index 000000000000..cb77ce581eff
--- /dev/null
+++ b/src/legacy/core_plugins/telemetry/server/collectors/localization/file_integrity.test.mocks.ts
@@ -0,0 +1,41 @@
+/*
+ * Licensed to Elasticsearch B.V. under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch B.V. licenses this file to you under
+ * the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import { Readable } from 'stream';
+
+jest.doMock('fs', () => ({
+ createReadStream(filepath: string): Readable {
+ if (filepath === 'ERROR') {
+ throw new Error('MOCK ERROR - Invalid Path');
+ }
+ const readableStream = new Readable();
+ const streamData = filepath.split('');
+ let cursor = 0;
+
+ readableStream._read = function(size) {
+ const current = streamData[cursor++];
+ if (typeof current === 'undefined') {
+ return this.push(null);
+ }
+ this.push(current);
+ };
+
+ return readableStream;
+ },
+}));
diff --git a/x-pack/legacy/plugins/telemetry/server/collectors/localization/file_integrity.test.ts b/src/legacy/core_plugins/telemetry/server/collectors/localization/file_integrity.test.ts
similarity index 56%
rename from x-pack/legacy/plugins/telemetry/server/collectors/localization/file_integrity.test.ts
rename to src/legacy/core_plugins/telemetry/server/collectors/localization/file_integrity.test.ts
index 668b0d0c2108..a0b566537f5b 100644
--- a/x-pack/legacy/plugins/telemetry/server/collectors/localization/file_integrity.test.ts
+++ b/src/legacy/core_plugins/telemetry/server/collectors/localization/file_integrity.test.ts
@@ -1,7 +1,20 @@
/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License;
- * you may not use this file except in compliance with the Elastic License.
+ * Licensed to Elasticsearch B.V. under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch B.V. licenses this file to you under
+ * the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
import './file_integrity.test.mocks';
diff --git a/x-pack/legacy/plugins/telemetry/server/collectors/localization/file_integrity.ts b/src/legacy/core_plugins/telemetry/server/collectors/localization/file_integrity.ts
similarity index 52%
rename from x-pack/legacy/plugins/telemetry/server/collectors/localization/file_integrity.ts
rename to src/legacy/core_plugins/telemetry/server/collectors/localization/file_integrity.ts
index 1db3795828ff..a852fba4a1c5 100644
--- a/x-pack/legacy/plugins/telemetry/server/collectors/localization/file_integrity.ts
+++ b/src/legacy/core_plugins/telemetry/server/collectors/localization/file_integrity.ts
@@ -1,7 +1,20 @@
/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License;
- * you may not use this file except in compliance with the Elastic License.
+ * Licensed to Elasticsearch B.V. under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch B.V. licenses this file to you under
+ * the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
import { createHash } from 'crypto';
diff --git a/src/legacy/core_plugins/telemetry/server/collectors/localization/index.ts b/src/legacy/core_plugins/telemetry/server/collectors/localization/index.ts
new file mode 100644
index 000000000000..3b289752ce39
--- /dev/null
+++ b/src/legacy/core_plugins/telemetry/server/collectors/localization/index.ts
@@ -0,0 +1,20 @@
+/*
+ * Licensed to Elasticsearch B.V. under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch B.V. licenses this file to you under
+ * the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+export { createLocalizationUsageCollector } from './telemetry_localization_collector';
diff --git a/x-pack/legacy/plugins/telemetry/server/collectors/localization/telemetry_localization_collector.test.ts b/src/legacy/core_plugins/telemetry/server/collectors/localization/telemetry_localization_collector.test.ts
similarity index 51%
rename from x-pack/legacy/plugins/telemetry/server/collectors/localization/telemetry_localization_collector.test.ts
rename to src/legacy/core_plugins/telemetry/server/collectors/localization/telemetry_localization_collector.test.ts
index 2cd3938e58ec..eec5cc8a065e 100644
--- a/x-pack/legacy/plugins/telemetry/server/collectors/localization/telemetry_localization_collector.test.ts
+++ b/src/legacy/core_plugins/telemetry/server/collectors/localization/telemetry_localization_collector.test.ts
@@ -1,7 +1,20 @@
/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License;
- * you may not use this file except in compliance with the Elastic License.
+ * Licensed to Elasticsearch B.V. under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch B.V. licenses this file to you under
+ * the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
interface TranslationsMock {
diff --git a/x-pack/legacy/plugins/telemetry/server/collectors/localization/telemetry_localization_collector.ts b/src/legacy/core_plugins/telemetry/server/collectors/localization/telemetry_localization_collector.ts
similarity index 64%
rename from x-pack/legacy/plugins/telemetry/server/collectors/localization/telemetry_localization_collector.ts
rename to src/legacy/core_plugins/telemetry/server/collectors/localization/telemetry_localization_collector.ts
index b66fe75e7af7..74c93931096b 100644
--- a/x-pack/legacy/plugins/telemetry/server/collectors/localization/telemetry_localization_collector.ts
+++ b/src/legacy/core_plugins/telemetry/server/collectors/localization/telemetry_localization_collector.ts
@@ -1,7 +1,20 @@
/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License;
- * you may not use this file except in compliance with the Elastic License.
+ * Licensed to Elasticsearch B.V. under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch B.V. licenses this file to you under
+ * the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
import { i18nLoader } from '@kbn/i18n';
diff --git a/src/legacy/core_plugins/telemetry/server/collectors/ui_metric/index.ts b/src/legacy/core_plugins/telemetry/server/collectors/ui_metric/index.ts
new file mode 100644
index 000000000000..e1ac7a1f5af1
--- /dev/null
+++ b/src/legacy/core_plugins/telemetry/server/collectors/ui_metric/index.ts
@@ -0,0 +1,20 @@
+/*
+ * Licensed to Elasticsearch B.V. under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch B.V. licenses this file to you under
+ * the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+export { createUiMetricUsageCollector } from './telemetry_ui_metric_collector';
diff --git a/x-pack/legacy/plugins/telemetry/server/collectors/ui_metric/telemetry_ui_metric_collector.ts b/src/legacy/core_plugins/telemetry/server/collectors/ui_metric/telemetry_ui_metric_collector.ts
similarity index 61%
rename from x-pack/legacy/plugins/telemetry/server/collectors/ui_metric/telemetry_ui_metric_collector.ts
rename to src/legacy/core_plugins/telemetry/server/collectors/ui_metric/telemetry_ui_metric_collector.ts
index a931400399b4..fa3159669c33 100644
--- a/x-pack/legacy/plugins/telemetry/server/collectors/ui_metric/telemetry_ui_metric_collector.ts
+++ b/src/legacy/core_plugins/telemetry/server/collectors/ui_metric/telemetry_ui_metric_collector.ts
@@ -1,7 +1,20 @@
/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License;
- * you may not use this file except in compliance with the Elastic License.
+ * Licensed to Elasticsearch B.V. under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch B.V. licenses this file to you under
+ * the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
import { UI_METRIC_USAGE_TYPE } from '../../../common/constants';
diff --git a/x-pack/legacy/plugins/telemetry/server/collectors/usage/ensure_deep_object.test.ts b/src/legacy/core_plugins/telemetry/server/collectors/usage/ensure_deep_object.test.ts
similarity index 72%
rename from x-pack/legacy/plugins/telemetry/server/collectors/usage/ensure_deep_object.test.ts
rename to src/legacy/core_plugins/telemetry/server/collectors/usage/ensure_deep_object.test.ts
index 4fad39230244..5a520fbeef31 100644
--- a/x-pack/legacy/plugins/telemetry/server/collectors/usage/ensure_deep_object.test.ts
+++ b/src/legacy/core_plugins/telemetry/server/collectors/usage/ensure_deep_object.test.ts
@@ -1,7 +1,20 @@
/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License;
- * you may not use this file except in compliance with the Elastic License.
+ * Licensed to Elasticsearch B.V. under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch B.V. licenses this file to you under
+ * the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
import { ensureDeepObject } from './ensure_deep_object';
diff --git a/x-pack/legacy/plugins/telemetry/server/collectors/usage/ensure_deep_object.ts b/src/legacy/core_plugins/telemetry/server/collectors/usage/ensure_deep_object.ts
similarity index 63%
rename from x-pack/legacy/plugins/telemetry/server/collectors/usage/ensure_deep_object.ts
rename to src/legacy/core_plugins/telemetry/server/collectors/usage/ensure_deep_object.ts
index 32a1bd869443..a8142afeaeee 100644
--- a/x-pack/legacy/plugins/telemetry/server/collectors/usage/ensure_deep_object.ts
+++ b/src/legacy/core_plugins/telemetry/server/collectors/usage/ensure_deep_object.ts
@@ -1,7 +1,20 @@
/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License;
- * you may not use this file except in compliance with the Elastic License.
+ * Licensed to Elasticsearch B.V. under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch B.V. licenses this file to you under
+ * the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
//
diff --git a/src/legacy/core_plugins/telemetry/server/collectors/usage/index.ts b/src/legacy/core_plugins/telemetry/server/collectors/usage/index.ts
new file mode 100644
index 000000000000..a1b3d5a7b198
--- /dev/null
+++ b/src/legacy/core_plugins/telemetry/server/collectors/usage/index.ts
@@ -0,0 +1,20 @@
+/*
+ * Licensed to Elasticsearch B.V. under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch B.V. licenses this file to you under
+ * the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+export { createTelemetryUsageCollector } from './telemetry_usage_collector';
diff --git a/x-pack/legacy/plugins/telemetry/server/collectors/usage/telemetry_usage_collector.test.ts b/src/legacy/core_plugins/telemetry/server/collectors/usage/telemetry_usage_collector.test.ts
similarity index 80%
rename from x-pack/legacy/plugins/telemetry/server/collectors/usage/telemetry_usage_collector.test.ts
rename to src/legacy/core_plugins/telemetry/server/collectors/usage/telemetry_usage_collector.test.ts
index d99f9dba334c..3806dfc77120 100644
--- a/x-pack/legacy/plugins/telemetry/server/collectors/usage/telemetry_usage_collector.test.ts
+++ b/src/legacy/core_plugins/telemetry/server/collectors/usage/telemetry_usage_collector.test.ts
@@ -1,7 +1,20 @@
/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License;
- * you may not use this file except in compliance with the Elastic License.
+ * Licensed to Elasticsearch B.V. under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch B.V. licenses this file to you under
+ * the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
import { writeFileSync, unlinkSync } from 'fs';
@@ -28,8 +41,8 @@ const serverWithConfig = (configPath: string): KibanaHapiServer & Server => {
...getMockServer(),
config: () => ({
get: (key: string) => {
- if (key !== 'xpack.telemetry.config' && key !== 'xpack.xpack_main.telemetry.config') {
- throw new Error('Expected `xpack.telemetry.config`');
+ if (key !== 'telemetry.config' && key !== 'xpack.xpack_main.telemetry.config') {
+ throw new Error('Expected `telemetry.config`');
}
return configPath;
diff --git a/x-pack/legacy/plugins/telemetry/server/collectors/usage/telemetry_usage_collector.ts b/src/legacy/core_plugins/telemetry/server/collectors/usage/telemetry_usage_collector.ts
similarity index 77%
rename from x-pack/legacy/plugins/telemetry/server/collectors/usage/telemetry_usage_collector.ts
rename to src/legacy/core_plugins/telemetry/server/collectors/usage/telemetry_usage_collector.ts
index a20f4198b3ad..c92745364119 100644
--- a/x-pack/legacy/plugins/telemetry/server/collectors/usage/telemetry_usage_collector.ts
+++ b/src/legacy/core_plugins/telemetry/server/collectors/usage/telemetry_usage_collector.ts
@@ -1,7 +1,20 @@
/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License;
- * you may not use this file except in compliance with the Elastic License.
+ * Licensed to Elasticsearch B.V. under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch B.V. licenses this file to you under
+ * the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
import { accessSync, constants, readFileSync, statSync } from 'fs';
diff --git a/x-pack/legacy/plugins/telemetry/server/get_telemetry_opt_in.ts b/src/legacy/core_plugins/telemetry/server/get_telemetry_opt_in.ts
similarity index 52%
rename from x-pack/legacy/plugins/telemetry/server/get_telemetry_opt_in.ts
rename to src/legacy/core_plugins/telemetry/server/get_telemetry_opt_in.ts
index 8f5af83985f1..9b365d6dd7ae 100644
--- a/x-pack/legacy/plugins/telemetry/server/get_telemetry_opt_in.ts
+++ b/src/legacy/core_plugins/telemetry/server/get_telemetry_opt_in.ts
@@ -1,7 +1,20 @@
/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License;
- * you may not use this file except in compliance with the Elastic License.
+ * Licensed to Elasticsearch B.V. under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch B.V. licenses this file to you under
+ * the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
export async function getTelemetryOptIn(request: any) {
diff --git a/src/legacy/core_plugins/telemetry/server/index.ts b/src/legacy/core_plugins/telemetry/server/index.ts
new file mode 100644
index 000000000000..b8ae5fc231fb
--- /dev/null
+++ b/src/legacy/core_plugins/telemetry/server/index.ts
@@ -0,0 +1,29 @@
+/*
+ * Licensed to Elasticsearch B.V. under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch B.V. licenses this file to you under
+ * the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import { PluginInitializerContext } from 'src/core/server';
+import { TelemetryPlugin } from './plugin';
+import * as constants from '../common/constants';
+
+export { getTelemetryOptIn } from './get_telemetry_opt_in';
+export { telemetryCollectionManager } from './collection_manager';
+
+export const telemetryPlugin = (initializerContext: PluginInitializerContext) =>
+ new TelemetryPlugin();
+export { constants };
diff --git a/src/legacy/core_plugins/telemetry/server/plugin.ts b/src/legacy/core_plugins/telemetry/server/plugin.ts
new file mode 100644
index 000000000000..70de51b2abe9
--- /dev/null
+++ b/src/legacy/core_plugins/telemetry/server/plugin.ts
@@ -0,0 +1,30 @@
+/*
+ * Licensed to Elasticsearch B.V. under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch B.V. licenses this file to you under
+ * the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import { CoreSetup } from 'src/core/server';
+import { registerRoutes } from './routes';
+import { telemetryCollectionManager } from './collection_manager';
+import { getStats } from './telemetry_collection';
+
+export class TelemetryPlugin {
+ public setup(core: CoreSetup) {
+ telemetryCollectionManager.setStatsGetter(getStats, 'local');
+ registerRoutes(core);
+ }
+}
diff --git a/src/legacy/core_plugins/telemetry/server/routes/index.ts b/src/legacy/core_plugins/telemetry/server/routes/index.ts
new file mode 100644
index 000000000000..12ba541d699f
--- /dev/null
+++ b/src/legacy/core_plugins/telemetry/server/routes/index.ts
@@ -0,0 +1,27 @@
+/*
+ * Licensed to Elasticsearch B.V. under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch B.V. licenses this file to you under
+ * the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import { CoreSetup } from 'src/core/server';
+import { registerOptInRoutes } from './opt_in';
+import { registerTelemetryDataRoutes } from './telemetry_stats';
+
+export function registerRoutes(core: CoreSetup) {
+ registerOptInRoutes(core);
+ registerTelemetryDataRoutes(core);
+}
diff --git a/x-pack/legacy/plugins/telemetry/server/routes/opt_in.ts b/src/legacy/core_plugins/telemetry/server/routes/opt_in.ts
similarity index 52%
rename from x-pack/legacy/plugins/telemetry/server/routes/opt_in.ts
rename to src/legacy/core_plugins/telemetry/server/routes/opt_in.ts
index 72c602e84f90..aabc0259f08f 100644
--- a/x-pack/legacy/plugins/telemetry/server/routes/opt_in.ts
+++ b/src/legacy/core_plugins/telemetry/server/routes/opt_in.ts
@@ -1,7 +1,20 @@
/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License;
- * you may not use this file except in compliance with the Elastic License.
+ * Licensed to Elasticsearch B.V. under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch B.V. licenses this file to you under
+ * the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
import Joi from 'joi';
diff --git a/x-pack/legacy/plugins/telemetry/server/routes/telemetry_stats.ts b/src/legacy/core_plugins/telemetry/server/routes/telemetry_stats.ts
similarity index 54%
rename from x-pack/legacy/plugins/telemetry/server/routes/telemetry_stats.ts
rename to src/legacy/core_plugins/telemetry/server/routes/telemetry_stats.ts
index 8ab4e68008e8..8a91d24b34ed 100644
--- a/x-pack/legacy/plugins/telemetry/server/routes/telemetry_stats.ts
+++ b/src/legacy/core_plugins/telemetry/server/routes/telemetry_stats.ts
@@ -1,13 +1,27 @@
/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License;
- * you may not use this file except in compliance with the Elastic License.
+ * Licensed to Elasticsearch B.V. under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch B.V. licenses this file to you under
+ * the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
import Joi from 'joi';
import { boomify } from 'boom';
import { CoreSetup } from 'src/core/server';
-import { getStats, encryptTelemetry } from '../collectors';
+import { encryptTelemetry } from '../collectors';
+import { telemetryCollectionManager } from '../collection_manager';
export function registerTelemetryDataRoutes(core: CoreSetup) {
const { server } = core.http as any;
@@ -34,13 +48,17 @@ export function registerTelemetryDataRoutes(core: CoreSetup) {
const isDev = config.get('env.dev');
try {
+ const { getStats, title } = telemetryCollectionManager.getStatsGetter();
+ server.log(['debug', 'telemetry'], `Using Stats Getter: ${title}`);
+
const usageData = await getStats(req, config, start, end, unencrypted);
+
if (unencrypted) return usageData;
return encryptTelemetry(usageData, isDev);
} catch (err) {
if (isDev) {
// don't ignore errors when running in dev mode
- return boomify(err, { statusCode: err.status });
+ return boomify(err, { statusCode: err.status || 500 });
} else {
const statusCode = unencrypted && err.status === 403 ? 403 : 200;
// ignore errors and return empty set
diff --git a/src/legacy/core_plugins/telemetry/server/telemetry_collection/__tests__/get_cluster_info.js b/src/legacy/core_plugins/telemetry/server/telemetry_collection/__tests__/get_cluster_info.js
new file mode 100644
index 000000000000..566e5b7019dd
--- /dev/null
+++ b/src/legacy/core_plugins/telemetry/server/telemetry_collection/__tests__/get_cluster_info.js
@@ -0,0 +1,41 @@
+/*
+ * Licensed to Elasticsearch B.V. under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch B.V. licenses this file to you under
+ * the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import expect from '@kbn/expect';
+import sinon from 'sinon';
+
+import { getClusterInfo } from '../get_cluster_info';
+
+export function mockGetClusterInfo(callCluster, clusterInfo, req) {
+ callCluster.withArgs(req, 'info').returns(clusterInfo);
+ callCluster.withArgs('info').returns(clusterInfo);
+}
+
+describe('get_cluster_info', () => {
+
+ it('uses callCluster to get info API', () => {
+ const callCluster = sinon.stub();
+ const response = Promise.resolve({});
+
+ mockGetClusterInfo(callCluster, response);
+
+ expect(getClusterInfo(callCluster)).to.be(response);
+ });
+
+});
diff --git a/src/legacy/core_plugins/telemetry/server/telemetry_collection/__tests__/get_cluster_stats.js b/src/legacy/core_plugins/telemetry/server/telemetry_collection/__tests__/get_cluster_stats.js
new file mode 100644
index 000000000000..9ca609cd8877
--- /dev/null
+++ b/src/legacy/core_plugins/telemetry/server/telemetry_collection/__tests__/get_cluster_stats.js
@@ -0,0 +1,49 @@
+/*
+ * Licensed to Elasticsearch B.V. under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch B.V. licenses this file to you under
+ * the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import expect from '@kbn/expect';
+import sinon from 'sinon';
+
+import { TIMEOUT } from '../constants';
+import { getClusterStats } from '../get_cluster_stats';
+
+export function mockGetClusterStats(callCluster, clusterStats, req) {
+ callCluster.withArgs(req, 'cluster.stats', {
+ timeout: TIMEOUT
+ })
+ .returns(clusterStats);
+
+ callCluster.withArgs('cluster.stats', {
+ timeout: TIMEOUT
+ })
+ .returns(clusterStats);
+}
+
+describe('get_cluster_stats', () => {
+
+ it('uses callCluster to get cluster.stats API', () => {
+ const callCluster = sinon.stub();
+ const response = Promise.resolve({});
+
+ mockGetClusterStats(callCluster, response);
+
+ expect(getClusterStats(callCluster)).to.be(response);
+ });
+
+});
diff --git a/x-pack/legacy/plugins/telemetry/server/collectors/local/__tests__/get_local_stats.js b/src/legacy/core_plugins/telemetry/server/telemetry_collection/__tests__/get_local_stats.js
similarity index 86%
rename from x-pack/legacy/plugins/telemetry/server/collectors/local/__tests__/get_local_stats.js
rename to src/legacy/core_plugins/telemetry/server/telemetry_collection/__tests__/get_local_stats.js
index e0879d208d6f..d0de9cc365a7 100644
--- a/x-pack/legacy/plugins/telemetry/server/collectors/local/__tests__/get_local_stats.js
+++ b/src/legacy/core_plugins/telemetry/server/telemetry_collection/__tests__/get_local_stats.js
@@ -1,7 +1,20 @@
/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License;
- * you may not use this file except in compliance with the Elastic License.
+ * Licensed to Elasticsearch B.V. under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch B.V. licenses this file to you under
+ * the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
import expect from '@kbn/expect';
@@ -9,7 +22,6 @@ import sinon from 'sinon';
import { mockGetClusterInfo } from './get_cluster_info';
import { mockGetClusterStats } from './get_cluster_stats';
-import { mockGetXPack } from './get_xpack';
import { omit } from 'lodash';
import {
@@ -22,17 +34,25 @@ const getMockServer = (getCluster = sinon.stub(), kibanaUsage = {}) => ({
log(tags, message) {
console.log({ tags, message });
},
+ config() {
+ return {
+ get(item) {
+ switch(item) {
+ case 'pkg.version': return '8675309-snapshot';
+ default: throw Error(`unexpected config.get('${item}') received.`);
+ }
+ }
+ };
+ },
usage: { collectorSet: { bulkFetch: () => kibanaUsage, toObject: data => data } },
plugins: {
- xpack_main: { status: { plugin: { kbnServer: { version: '8675309-snapshot' } } } },
elasticsearch: { getCluster },
},
});
-function mockGetLocalStats(callCluster, clusterInfo, clusterStats, license, usage, req) {
+function mockGetLocalStats(callCluster, clusterInfo, clusterStats, req) {
mockGetClusterInfo(callCluster, clusterInfo, req);
mockGetClusterStats(callCluster, clusterStats, req);
- mockGetXPack(callCluster, license, usage, req);
}
describe('get_local_stats', () => {
@@ -53,8 +73,6 @@ describe('get_local_stats', () => {
nodes: { yup: 'abc' },
random: 123
};
- const license = { fancy: 'license' };
- const xpack = { also: 'fancy' };
const kibana = {
kibana: {
great: 'googlymoogly',
@@ -81,9 +99,6 @@ describe('get_local_stats', () => {
collection: 'local',
cluster_uuid: clusterUuid,
cluster_name: clusterName,
- license: {
- fancy: 'license'
- },
version,
cluster_stats: omit(clusterStats, '_nodes', 'cluster_name'),
stack_stats: {
@@ -108,7 +123,6 @@ describe('get_local_stats', () => {
snow: { chances: 0 },
}
},
- xpack: { also: 'fancy' },
}
};
@@ -121,11 +135,11 @@ describe('get_local_stats', () => {
expect(result.version).to.be('2.3.4');
expect(result.collection).to.be('local');
expect(result.license).to.be(undefined);
- expect(result.stack_stats).to.eql({ kibana: undefined, xpack: undefined });
+ expect(result.stack_stats).to.eql({ kibana: undefined });
});
it('returns expected object with xpack', () => {
- const result = handleLocalStats(getMockServer(), clusterInfo, clusterStats, license, xpack);
+ const result = handleLocalStats(getMockServer(), clusterInfo, clusterStats);
const { stack_stats: stack, ...cluster } = result;
expect(cluster.collection).to.be(combinedStatsResult.collection);
expect(cluster.cluster_uuid).to.be(combinedStatsResult.cluster_uuid);
@@ -147,8 +161,6 @@ describe('get_local_stats', () => {
callClusterUsageFailed,
Promise.resolve(clusterInfo),
Promise.resolve(clusterStats),
- Promise.resolve(license),
- Promise.reject('usage failed')
);
const result = await getLocalStatsWithCaller(getMockServer(), callClusterUsageFailed);
@@ -170,8 +182,6 @@ describe('get_local_stats', () => {
callCluster,
Promise.resolve(clusterInfo),
Promise.resolve(clusterStats),
- Promise.resolve(license),
- Promise.resolve(xpack)
);
const result = await getLocalStatsWithCaller(getMockServer(callCluster, kibana), callCluster);
@@ -192,8 +202,6 @@ describe('get_local_stats', () => {
callWithInternalUser,
Promise.resolve(clusterInfo),
Promise.resolve(clusterStats),
- Promise.resolve(license),
- Promise.resolve(xpack)
);
const result = await getLocalStats(req, { useInternalUser: true });
@@ -213,8 +221,6 @@ describe('get_local_stats', () => {
callWithRequest,
Promise.resolve(clusterInfo),
Promise.resolve(clusterStats),
- Promise.resolve(license),
- Promise.resolve(xpack),
req
);
diff --git a/src/legacy/core_plugins/telemetry/server/telemetry_collection/constants.ts b/src/legacy/core_plugins/telemetry/server/telemetry_collection/constants.ts
new file mode 100644
index 000000000000..ad14bfe7430d
--- /dev/null
+++ b/src/legacy/core_plugins/telemetry/server/telemetry_collection/constants.ts
@@ -0,0 +1,23 @@
+/*
+ * Licensed to Elasticsearch B.V. under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch B.V. licenses this file to you under
+ * the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/**
+ * The timeout used by each request, whenever a timeout can be specified.
+ */
+export const TIMEOUT = '30s';
diff --git a/src/legacy/core_plugins/telemetry/server/telemetry_collection/get_cluster_info.js b/src/legacy/core_plugins/telemetry/server/telemetry_collection/get_cluster_info.js
new file mode 100644
index 000000000000..2e4ed0b36ed2
--- /dev/null
+++ b/src/legacy/core_plugins/telemetry/server/telemetry_collection/get_cluster_info.js
@@ -0,0 +1,30 @@
+/*
+ * Licensed to Elasticsearch B.V. under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch B.V. licenses this file to you under
+ * the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/**
+ * Get the cluster info from the connected cluster.
+ *
+ * This is the equivalent to GET /
+ *
+ * @param {function} callCluster The callWithInternalUser handler (exposed for testing)
+ * @return {Promise} The response from Elasticsearch.
+ */
+export function getClusterInfo(callCluster) {
+ return callCluster('info');
+}
diff --git a/src/legacy/core_plugins/telemetry/server/telemetry_collection/get_cluster_stats.js b/src/legacy/core_plugins/telemetry/server/telemetry_collection/get_cluster_stats.js
new file mode 100644
index 000000000000..a840c39812e2
--- /dev/null
+++ b/src/legacy/core_plugins/telemetry/server/telemetry_collection/get_cluster_stats.js
@@ -0,0 +1,34 @@
+/*
+ * Licensed to Elasticsearch B.V. under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch B.V. licenses this file to you under
+ * the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import { TIMEOUT } from './constants';
+
+/**
+ * Get the cluster stats from the connected cluster.
+ *
+ * This is the equivalent to GET /_cluster/stats?timeout=30s.
+ *
+ * @param {function} callCluster The callWithInternalUser handler (exposed for testing)
+ * @return {Promise} The response from Elasticsearch equivalent to GET /_cluster/stats.
+ */
+export function getClusterStats(callCluster) {
+ return callCluster('cluster.stats', {
+ timeout: TIMEOUT
+ });
+}
diff --git a/src/legacy/core_plugins/telemetry/server/telemetry_collection/get_kibana.js b/src/legacy/core_plugins/telemetry/server/telemetry_collection/get_kibana.js
new file mode 100644
index 000000000000..051ef370fcde
--- /dev/null
+++ b/src/legacy/core_plugins/telemetry/server/telemetry_collection/get_kibana.js
@@ -0,0 +1,58 @@
+/*
+ * Licensed to Elasticsearch B.V. under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch B.V. licenses this file to you under
+ * the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import { get, omit } from 'lodash';
+
+export function handleKibanaStats(server, response) {
+ if (!response) {
+ server.log(['warning', 'telemetry', 'local-stats'], 'No Kibana stats returned from usage collectors');
+ return;
+ }
+
+ const { kibana, kibana_stats: kibanaStats, ...plugins } = response;
+
+ const platform = get(kibanaStats, 'os.platform', 'unknown');
+ const platformRelease = get(kibanaStats, 'os.platformRelease', 'unknown');
+
+ const version = server.config().get('pkg.version').replace(/-snapshot/i, '');
+
+ // combine core stats (os types, saved objects) with plugin usage stats
+ // organize the object into the same format as monitoring-enabled telemetry
+ return {
+ ...omit(kibana, 'index'), // discard index
+ count: 1,
+ indices: 1,
+ os: {
+ platforms: [{ platform, count: 1 }],
+ platformReleases: [{ platformRelease, count: 1 }],
+ },
+ versions: [{ version, count: 1 }],
+ plugins,
+ };
+}
+
+/*
+ * Check user privileges for read access to monitoring
+ * Pass callWithInternalUser to bulkFetchUsage
+ */
+export async function getKibana(server, callWithInternalUser) {
+ const { collectorSet } = server.usage;
+ const usage = await collectorSet.bulkFetch(callWithInternalUser);
+ return collectorSet.toObject(usage);
+}
diff --git a/x-pack/legacy/plugins/telemetry/server/collectors/local/get_local_stats.js b/src/legacy/core_plugins/telemetry/server/telemetry_collection/get_local_stats.js
similarity index 62%
rename from x-pack/legacy/plugins/telemetry/server/collectors/local/get_local_stats.js
rename to src/legacy/core_plugins/telemetry/server/telemetry_collection/get_local_stats.js
index 5f6f738b6e50..67fc721306c2 100644
--- a/x-pack/legacy/plugins/telemetry/server/collectors/local/get_local_stats.js
+++ b/src/legacy/core_plugins/telemetry/server/telemetry_collection/get_local_stats.js
@@ -1,13 +1,25 @@
/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License;
- * you may not use this file except in compliance with the Elastic License.
+ * Licensed to Elasticsearch B.V. under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch B.V. licenses this file to you under
+ * the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
import { get, omit } from 'lodash';
import { getClusterInfo } from './get_cluster_info';
import { getClusterStats } from './get_cluster_stats';
-import { getXPack } from './get_xpack';
import { getKibana, handleKibanaStats } from './get_kibana';
/**
@@ -16,10 +28,9 @@ import { getKibana, handleKibanaStats } from './get_kibana';
*
* @param {Object} clusterInfo Cluster info (GET /)
* @param {Object} clusterStats Cluster stats (GET /_cluster/stats)
- * @param {Object} xpack License and X-Pack details
* @return {Object} A combined object containing the different responses.
*/
-export function handleLocalStats(server, clusterInfo, clusterStats, license, xpack, kibana) {
+export function handleLocalStats(server, clusterInfo, clusterStats, kibana) {
return {
timestamp: (new Date()).toISOString(),
cluster_uuid: get(clusterInfo, 'cluster_uuid'),
@@ -27,10 +38,8 @@ export function handleLocalStats(server, clusterInfo, clusterStats, license, xpa
version: get(clusterInfo, 'version.number'),
cluster_stats: omit(clusterStats, '_nodes', 'cluster_name'),
collection: 'local',
- license,
stack_stats: {
kibana: handleKibanaStats(server, kibana),
- xpack,
}
};
}
@@ -42,18 +51,17 @@ export function handleLocalStats(server, clusterInfo, clusterStats, license, xpa
* @param {function} callCluster The callWithInternalUser handler (exposed for testing)
* @return {Promise} The object containing the current Elasticsearch cluster's telemetry.
*/
-export function getLocalStatsWithCaller(server, callCluster) {
- return Promise.all([
+export async function getLocalStatsWithCaller(server, callCluster) {
+ const [ clusterInfo, clusterStats, kibana ] = await Promise.all([
getClusterInfo(callCluster), // cluster info
getClusterStats(callCluster), // cluster stats (not to be confused with cluster _state_)
- getXPack(callCluster), // { license, xpack }
- getKibana(server, callCluster)
- ]).then(([clusterInfo, clusterStats, { license, xpack }, kibana]) => {
- return handleLocalStats(server, clusterInfo, clusterStats, license, xpack, kibana);
- }
- );
+ getKibana(server, callCluster),
+ ]);
+
+ return handleLocalStats(server, clusterInfo, clusterStats, kibana);
}
+
/**
* Get statistics for the connected Elasticsearch cluster.
*
@@ -61,10 +69,10 @@ export function getLocalStatsWithCaller(server, callCluster) {
* @param {Boolean} useRequestUser callWithRequest, otherwise callWithInternalUser
* @return {Promise} The cluster object containing telemetry.
*/
-export function getLocalStats(req, { useInternalUser = false } = {}) {
+export async function getLocalStats(req, { useInternalUser = false } = {}) {
const { server } = req;
const { callWithRequest, callWithInternalUser } = server.plugins.elasticsearch.getCluster('data');
const callCluster = useInternalUser ? callWithInternalUser : (...args) => callWithRequest(req, ...args);
- return getLocalStatsWithCaller(server, callCluster);
+ return await getLocalStatsWithCaller(server, callCluster);
}
diff --git a/src/legacy/core_plugins/telemetry/server/telemetry_collection/get_stats.ts b/src/legacy/core_plugins/telemetry/server/telemetry_collection/get_stats.ts
new file mode 100644
index 000000000000..024272e0f805
--- /dev/null
+++ b/src/legacy/core_plugins/telemetry/server/telemetry_collection/get_stats.ts
@@ -0,0 +1,45 @@
+/*
+ * Licensed to Elasticsearch B.V. under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch B.V. licenses this file to you under
+ * the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+// @ts-ignore
+import { getLocalStats } from './get_local_stats';
+
+/**
+ * Get the telemetry data.
+ *
+ * @param {Object} req The incoming request.
+ * @param {Object} config Kibana config.
+ * @param {String} start The start time of the request (likely 20m ago).
+ * @param {String} end The end time of the request.
+ * @param {Boolean} unencrypted Is the request payload going to be unencrypted.
+ * @return {Promise} An array of telemetry objects.
+ */
+export async function getStats(
+ req: any,
+ config: any,
+ start: string,
+ end: string,
+ unencrypted: boolean
+) {
+ return [
+ await getLocalStats(req, {
+ useInternalUser: !unencrypted,
+ }),
+ ];
+}
diff --git a/src/legacy/core_plugins/telemetry/server/telemetry_collection/index.ts b/src/legacy/core_plugins/telemetry/server/telemetry_collection/index.ts
new file mode 100644
index 000000000000..f33727d82f44
--- /dev/null
+++ b/src/legacy/core_plugins/telemetry/server/telemetry_collection/index.ts
@@ -0,0 +1,24 @@
+/*
+ * Licensed to Elasticsearch B.V. under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch B.V. licenses this file to you under
+ * the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+// @ts-ignore
+export { getLocalStats } from './get_local_stats';
+
+// @ts-ignore
+export { getStats } from './get_stats';
diff --git a/test/common/config.js b/test/common/config.js
index 452413fe4e4e..44e4bef99bf6 100644
--- a/test/common/config.js
+++ b/test/common/config.js
@@ -55,6 +55,7 @@ export default function () {
`--elasticsearch.username=${servers.elasticsearch.username}`,
`--elasticsearch.password=${servers.elasticsearch.password}`,
`--kibana.disableWelcomeScreen=true`,
+ '--telemetry.banner=false',
`--server.maxPayloadBytes=1679958`,
],
},
diff --git a/typings/elastic__node_crypto.d.ts b/typings/elastic__node_crypto.d.ts
new file mode 100644
index 000000000000..8d4b47da96b7
--- /dev/null
+++ b/typings/elastic__node_crypto.d.ts
@@ -0,0 +1,20 @@
+/*
+ * Licensed to Elasticsearch B.V. under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch B.V. licenses this file to you under
+ * the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+declare module '@elastic/node-crypto';
diff --git a/x-pack/.i18nrc.json b/x-pack/.i18nrc.json
index 872d4ed9c29d..e0ba45555296 100644
--- a/x-pack/.i18nrc.json
+++ b/x-pack/.i18nrc.json
@@ -25,7 +25,6 @@
"xpack.ml": "legacy/plugins/ml",
"xpack.logstash": "legacy/plugins/logstash",
"xpack.main": "legacy/plugins/xpack_main",
- "xpack.telemetry": "legacy/plugins/telemetry",
"xpack.monitoring": "legacy/plugins/monitoring",
"xpack.remoteClusters": "legacy/plugins/remote_clusters",
"xpack.reporting": "legacy/plugins/reporting",
diff --git a/x-pack/index.js b/x-pack/index.js
index f2e602ec0558..756d9b4d3127 100644
--- a/x-pack/index.js
+++ b/x-pack/index.js
@@ -38,7 +38,6 @@ import { upgradeAssistant } from './legacy/plugins/upgrade_assistant';
import { uptime } from './legacy/plugins/uptime';
import { ossTelemetry } from './legacy/plugins/oss_telemetry';
import { fileUpload } from './legacy/plugins/file_upload';
-import { telemetry } from './legacy/plugins/telemetry';
import { encryptedSavedObjects } from './legacy/plugins/encrypted_saved_objects';
import { snapshotRestore } from './legacy/plugins/snapshot_restore';
import { transform } from './legacy/plugins/transform';
@@ -49,7 +48,6 @@ import { lens } from './legacy/plugins/lens';
module.exports = function (kibana) {
return [
xpackMain(kibana),
- telemetry(kibana),
graph(kibana),
monitoring(kibana),
reporting(kibana),
diff --git a/x-pack/legacy/plugins/license_management/public/lib/telemetry.js b/x-pack/legacy/plugins/license_management/public/lib/telemetry.js
index 08928549916e..bf8bed05aabe 100644
--- a/x-pack/legacy/plugins/license_management/public/lib/telemetry.js
+++ b/x-pack/legacy/plugins/license_management/public/lib/telemetry.js
@@ -4,10 +4,10 @@
* you may not use this file except in compliance with the Elastic License.
*/
-import { fetchTelemetry } from '../../../telemetry/public/hacks/fetch_telemetry';
-export { PRIVACY_STATEMENT_URL } from '../../../telemetry/common/constants';
-export { TelemetryOptInProvider } from '../../../telemetry/public/services/telemetry_opt_in';
-export { OptInExampleFlyout } from '../../../telemetry/public/components';
+import { fetchTelemetry } from '../../../../../../src/legacy/core_plugins/telemetry/public/hacks/fetch_telemetry';
+export { PRIVACY_STATEMENT_URL } from '../../../../../../src/legacy/core_plugins/telemetry/common/constants';
+export { TelemetryOptInProvider } from '../../../../../../src/legacy/core_plugins/telemetry/public/services';
+export { OptInExampleFlyout } from '../../../../../../src/legacy/core_plugins/telemetry/public/components';
let telemetryEnabled;
let httpClient;
diff --git a/x-pack/legacy/plugins/monitoring/common/constants.js b/x-pack/legacy/plugins/monitoring/common/constants.js
index f953741cd2e0..e40941396b66 100644
--- a/x-pack/legacy/plugins/monitoring/common/constants.js
+++ b/x-pack/legacy/plugins/monitoring/common/constants.js
@@ -155,10 +155,7 @@ export const METRICBEAT_INDEX_NAME_UNIQUE_TOKEN = '-mb-';
// We use this for metricbeat migration to identify specific products that we do not have constants for
export const ELASTICSEARCH_SYSTEM_ID = 'elasticsearch';
-export const KIBANA_SYSTEM_ID = 'kibana';
-export const BEATS_SYSTEM_ID = 'beats';
-export const APM_SYSTEM_ID = 'apm';
-export const LOGSTASH_SYSTEM_ID = 'logstash';
+
/**
* The id of the infra source owned by the monitoring plugin.
*/
@@ -181,3 +178,47 @@ export const CODE_PATH_LOGSTASH = 'logstash';
export const CODE_PATH_APM = 'apm';
export const CODE_PATH_LICENSE = 'license';
export const CODE_PATH_LOGS = 'logs';
+
+/**
+ * The header sent by telemetry service when hitting Elasticsearch to identify query source
+ * @type {string}
+ */
+export const TELEMETRY_QUERY_SOURCE = 'TELEMETRY';
+
+/**
+ * The name of the Kibana System ID used to publish and look up Kibana stats through the Monitoring system.
+ * @type {string}
+ */
+export const KIBANA_SYSTEM_ID = 'kibana';
+
+/**
+ * The name of the Beats System ID used to publish and look up Beats stats through the Monitoring system.
+ * @type {string}
+ */
+export const BEATS_SYSTEM_ID = 'beats';
+
+/**
+ * The name of the Apm System ID used to publish and look up Apm stats through the Monitoring system.
+ * @type {string}
+ */
+export const APM_SYSTEM_ID = 'apm';
+
+/**
+ * The name of the Kibana System ID used to look up Logstash stats through the Monitoring system.
+ * @type {string}
+ */
+export const LOGSTASH_SYSTEM_ID = 'logstash';
+
+/**
+ * The name of the Kibana System ID used to look up Reporting stats through the Monitoring system.
+ * @type {string}
+ */
+export const REPORTING_SYSTEM_ID = 'reporting';
+
+/**
+ * The amount of time, in milliseconds, to wait between collecting kibana stats from es.
+ *
+ * Currently 24 hours kept in sync with reporting interval.
+ * @type {Number}
+ */
+export const TELEMETRY_COLLECTION_INTERVAL = 86400000;
diff --git a/x-pack/legacy/plugins/monitoring/server/kibana_monitoring/__tests__/bulk_uploader.js b/x-pack/legacy/plugins/monitoring/server/kibana_monitoring/__tests__/bulk_uploader.js
index d494963c4492..3cacf00016f0 100644
--- a/x-pack/legacy/plugins/monitoring/server/kibana_monitoring/__tests__/bulk_uploader.js
+++ b/x-pack/legacy/plugins/monitoring/server/kibana_monitoring/__tests__/bulk_uploader.js
@@ -49,9 +49,6 @@ describe('BulkUploader', () => {
server = {
log: sinon.spy(),
- xpackMainPlugin: {
- telemetryCollectionInterval: 3000,
- },
elasticsearchPlugin: {
createCluster: () => cluster,
getCluster: () => cluster,
diff --git a/x-pack/legacy/plugins/monitoring/server/kibana_monitoring/bulk_uploader.js b/x-pack/legacy/plugins/monitoring/server/kibana_monitoring/bulk_uploader.js
index 015af8f3d633..da23d4b77a32 100644
--- a/x-pack/legacy/plugins/monitoring/server/kibana_monitoring/bulk_uploader.js
+++ b/x-pack/legacy/plugins/monitoring/server/kibana_monitoring/bulk_uploader.js
@@ -10,7 +10,9 @@ import { callClusterFactory } from '../../../xpack_main';
import {
LOGGING_TAG,
KIBANA_MONITORING_LOGGING_TAG,
+ TELEMETRY_COLLECTION_INTERVAL,
} from '../../common/constants';
+
import {
sendBulkPayload,
monitoringBulk,
@@ -36,7 +38,7 @@ const LOGGING_TAGS = [LOGGING_TAG, KIBANA_MONITORING_LOGGING_TAG];
* @param {Object} xpackInfo server.plugins.xpack_main.info object
*/
export class BulkUploader {
- constructor({ config, log, interval, xpackMainPlugin, elasticsearchPlugin, kbnServerStatus, kbnServerVersion }) {
+ constructor({ config, log, interval, elasticsearchPlugin, kbnServerStatus, kbnServerVersion }) {
if (typeof interval !== 'number') {
throw new Error('interval number of milliseconds is required');
}
@@ -44,7 +46,7 @@ export class BulkUploader {
this._timer = null;
this._interval = interval;
this._lastFetchUsageTime = null;
- this._usageInterval = xpackMainPlugin.telemetryCollectionInterval;
+ this._usageInterval = TELEMETRY_COLLECTION_INTERVAL;
this._log = {
debug: message => log(['debug', ...LOGGING_TAGS], message),
diff --git a/x-pack/legacy/plugins/monitoring/server/kibana_monitoring/lib/send_bulk_payload.js b/x-pack/legacy/plugins/monitoring/server/kibana_monitoring/lib/send_bulk_payload.js
index 208fb6305457..3a286e4d7a51 100644
--- a/x-pack/legacy/plugins/monitoring/server/kibana_monitoring/lib/send_bulk_payload.js
+++ b/x-pack/legacy/plugins/monitoring/server/kibana_monitoring/lib/send_bulk_payload.js
@@ -4,8 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/
-import { MONITORING_SYSTEM_API_VERSION } from '../../../common/constants';
-import { KIBANA_SYSTEM_ID } from '../../../../telemetry/common/constants';
+import { MONITORING_SYSTEM_API_VERSION, KIBANA_SYSTEM_ID } from '../../../common/constants';
/*
* Send the Kibana usage data to the ES Monitoring Bulk endpoint
diff --git a/x-pack/legacy/plugins/monitoring/server/plugin.js b/x-pack/legacy/plugins/monitoring/server/plugin.js
index 349e705434bf..ab7813aa2656 100644
--- a/x-pack/legacy/plugins/monitoring/server/plugin.js
+++ b/x-pack/legacy/plugins/monitoring/server/plugin.js
@@ -10,6 +10,9 @@ import { requireUIRoutes } from './routes';
import { instantiateClient } from './es_client/instantiate_client';
import { initMonitoringXpackInfo } from './init_monitoring_xpack_info';
import { initBulkUploader } from './kibana_monitoring';
+import { telemetryCollectionManager } from '../../../../../src/legacy/core_plugins/telemetry/server';
+import { getStatsWithMonitoring } from './telemetry_collection';
+
import {
getKibanaUsageCollector,
getOpsStatsCollector,
@@ -36,6 +39,8 @@ export class Plugin {
collectorSet.register(getKibanaUsageCollector({ collectorSet, config }));
collectorSet.register(getSettingsCollector({ collectorSet, config }));
+ telemetryCollectionManager.setStatsGetter(getStatsWithMonitoring, 'monitoring', 2);
+
/*
* Instantiate and start the internal background task that calls collector
* fetch methods and uploads to the ES monitoring bulk endpoint
@@ -90,7 +95,6 @@ export class Plugin {
const bulkUploader = initBulkUploader({
elasticsearchPlugin: plugins.elasticsearch,
- xpackMainPlugin: plugins.xpack_main,
config,
log: core.log,
kbnServerStatus: kbnServer.status,
diff --git a/x-pack/legacy/plugins/telemetry/server/collectors/monitoring/__tests__/create_query.js b/x-pack/legacy/plugins/monitoring/server/telemetry_collection/__tests__/create_query.js
similarity index 100%
rename from x-pack/legacy/plugins/telemetry/server/collectors/monitoring/__tests__/create_query.js
rename to x-pack/legacy/plugins/monitoring/server/telemetry_collection/__tests__/create_query.js
diff --git a/x-pack/legacy/plugins/telemetry/server/collectors/monitoring/__tests__/fixtures/beats_stats_results.json b/x-pack/legacy/plugins/monitoring/server/telemetry_collection/__tests__/fixtures/beats_stats_results.json
similarity index 100%
rename from x-pack/legacy/plugins/telemetry/server/collectors/monitoring/__tests__/fixtures/beats_stats_results.json
rename to x-pack/legacy/plugins/monitoring/server/telemetry_collection/__tests__/fixtures/beats_stats_results.json
diff --git a/x-pack/legacy/plugins/telemetry/server/collectors/monitoring/__tests__/get_all_stats.js b/x-pack/legacy/plugins/monitoring/server/telemetry_collection/__tests__/get_all_stats.js
similarity index 95%
rename from x-pack/legacy/plugins/telemetry/server/collectors/monitoring/__tests__/get_all_stats.js
rename to x-pack/legacy/plugins/monitoring/server/telemetry_collection/__tests__/get_all_stats.js
index fff281a0d87e..0d147b747f2d 100644
--- a/x-pack/legacy/plugins/telemetry/server/collectors/monitoring/__tests__/get_all_stats.js
+++ b/x-pack/legacy/plugins/monitoring/server/telemetry_collection/__tests__/get_all_stats.js
@@ -6,7 +6,7 @@
import expect from '@kbn/expect';
import sinon from 'sinon';
-import { addStackStats, getAllStats, getAllStatsForServer, handleAllStats } from '../get_all_stats';
+import { addStackStats, getAllStats, handleAllStats } from '../get_all_stats';
describe('get_all_stats', () => {
const size = 123;
@@ -106,7 +106,7 @@ describe('get_all_stats', () => {
}
];
- describe('getAllStats / getAllStatsForServer return the same results', () => {
+ describe('getAllStats', () => {
it('returns clusters', async () => {
const clusterUuidsResponse = {
aggregations: { cluster_uuids: { buckets: [ { key: 'a' } ] } }
@@ -201,7 +201,6 @@ describe('get_all_stats', () => {
.onCall(3).returns(Promise.resolve(logstashStatsResponse));
expect(await getAllStats(req, start, end)).to.eql(allClusters);
- expect(await getAllStatsForServer(server, start, end)).to.eql(allClusters);
});
it('returns empty clusters', async () => {
@@ -213,7 +212,6 @@ describe('get_all_stats', () => {
callWithInternalUser.withArgs('search').returns(Promise.resolve(clusterUuidsResponse));
expect(await getAllStats(req, start, end)).to.eql([]);
- expect(await getAllStatsForServer(server, start, end)).to.eql([]);
});
});
diff --git a/x-pack/legacy/plugins/telemetry/server/collectors/monitoring/__tests__/get_beats_stats.js b/x-pack/legacy/plugins/monitoring/server/telemetry_collection/__tests__/get_beats_stats.js
similarity index 100%
rename from x-pack/legacy/plugins/telemetry/server/collectors/monitoring/__tests__/get_beats_stats.js
rename to x-pack/legacy/plugins/monitoring/server/telemetry_collection/__tests__/get_beats_stats.js
diff --git a/x-pack/legacy/plugins/telemetry/server/collectors/monitoring/__tests__/get_cluster_uuids.js b/x-pack/legacy/plugins/monitoring/server/telemetry_collection/__tests__/get_cluster_uuids.js
similarity index 100%
rename from x-pack/legacy/plugins/telemetry/server/collectors/monitoring/__tests__/get_cluster_uuids.js
rename to x-pack/legacy/plugins/monitoring/server/telemetry_collection/__tests__/get_cluster_uuids.js
diff --git a/x-pack/legacy/plugins/telemetry/server/collectors/monitoring/__tests__/get_es_stats.js b/x-pack/legacy/plugins/monitoring/server/telemetry_collection/__tests__/get_es_stats.js
similarity index 100%
rename from x-pack/legacy/plugins/telemetry/server/collectors/monitoring/__tests__/get_es_stats.js
rename to x-pack/legacy/plugins/monitoring/server/telemetry_collection/__tests__/get_es_stats.js
diff --git a/x-pack/legacy/plugins/telemetry/server/collectors/monitoring/__tests__/get_high_level_stats.js b/x-pack/legacy/plugins/monitoring/server/telemetry_collection/__tests__/get_high_level_stats.js
similarity index 100%
rename from x-pack/legacy/plugins/telemetry/server/collectors/monitoring/__tests__/get_high_level_stats.js
rename to x-pack/legacy/plugins/monitoring/server/telemetry_collection/__tests__/get_high_level_stats.js
diff --git a/x-pack/legacy/plugins/telemetry/server/collectors/monitoring/__tests__/get_kibana_stats.js b/x-pack/legacy/plugins/monitoring/server/telemetry_collection/__tests__/get_kibana_stats.js
similarity index 100%
rename from x-pack/legacy/plugins/telemetry/server/collectors/monitoring/__tests__/get_kibana_stats.js
rename to x-pack/legacy/plugins/monitoring/server/telemetry_collection/__tests__/get_kibana_stats.js
diff --git a/x-pack/legacy/plugins/telemetry/server/collectors/monitoring/create_query.js b/x-pack/legacy/plugins/monitoring/server/telemetry_collection/create_query.js
similarity index 100%
rename from x-pack/legacy/plugins/telemetry/server/collectors/monitoring/create_query.js
rename to x-pack/legacy/plugins/monitoring/server/telemetry_collection/create_query.js
diff --git a/x-pack/legacy/plugins/telemetry/server/collectors/monitoring/get_all_stats.js b/x-pack/legacy/plugins/monitoring/server/telemetry_collection/get_all_stats.js
similarity index 84%
rename from x-pack/legacy/plugins/telemetry/server/collectors/monitoring/get_all_stats.js
rename to x-pack/legacy/plugins/monitoring/server/telemetry_collection/get_all_stats.js
index bc93dad72214..b1e8db1b9600 100644
--- a/x-pack/legacy/plugins/telemetry/server/collectors/monitoring/get_all_stats.js
+++ b/x-pack/legacy/plugins/monitoring/server/telemetry_collection/get_all_stats.js
@@ -6,7 +6,11 @@
import { get, set, merge } from 'lodash';
-import { constants } from '../../';
+import {
+ LOGSTASH_SYSTEM_ID,
+ KIBANA_SYSTEM_ID,
+ BEATS_SYSTEM_ID,
+} from '../../common/constants';
import { getClusterUuids } from './get_cluster_uuids';
import { getElasticsearchStats } from './get_es_stats';
import { getKibanaStats } from './get_kibana_stats';
@@ -30,20 +34,6 @@ export function getAllStats(req, start, end, { useInternalUser = false } = {}) {
return getAllStatsWithCaller(server, callCluster, start, end);
}
-/**
- * Get statistics for all products joined by Elasticsearch cluster.
- *
- * @param {Object} server The server instance used to call ES as the internal user
- * @param {Date} start The starting range to request data
- * @param {Date} end The ending range to request data
- * @return {Promise} The array of clusters joined with the Kibana and Logstash instances.
- */
-export function getAllStatsForServer(server, start, end) {
- const { callWithInternalUser } = server.plugins.elasticsearch.getCluster('monitoring');
-
- return getAllStatsWithCaller(server, callWithInternalUser, start, end);
-}
-
/**
* Get statistics for all products joined by Elasticsearch cluster.
*
@@ -64,7 +54,7 @@ function getAllStatsWithCaller(server, callCluster, start, end) {
return Promise.all([
getElasticsearchStats(server, callCluster, clusterUuids), // cluster_stats, stack_stats.xpack, cluster_name/uuid, license, version
getKibanaStats(server, callCluster, clusterUuids, start, end), // stack_stats.kibana
- getHighLevelStats(server, callCluster, clusterUuids, start, end, constants.LOGSTASH_SYSTEM_ID), // stack_stats.logstash
+ getHighLevelStats(server, callCluster, clusterUuids, start, end, LOGSTASH_SYSTEM_ID), // stack_stats.logstash
getBeatsStats(server, callCluster, clusterUuids, start, end), // stack_stats.beats
])
.then(([esClusters, kibana, logstash, beats]) => handleAllStats(esClusters, { kibana, logstash, beats }));
@@ -83,9 +73,9 @@ function getAllStatsWithCaller(server, callCluster, start, end) {
export function handleAllStats(clusters, { kibana, logstash, beats }) {
return clusters.map(cluster => {
// if they are using Kibana or Logstash, then add it to the cluster details under cluster.stack_stats
- addStackStats(cluster, kibana, constants.KIBANA_SYSTEM_ID);
- addStackStats(cluster, logstash, constants.LOGSTASH_SYSTEM_ID);
- addStackStats(cluster, beats, constants.BEATS_SYSTEM_ID);
+ addStackStats(cluster, kibana, KIBANA_SYSTEM_ID);
+ addStackStats(cluster, logstash, LOGSTASH_SYSTEM_ID);
+ addStackStats(cluster, beats, BEATS_SYSTEM_ID);
mergeXPackStats(cluster, kibana, 'graph_workspace', 'graph'); // copy graph_workspace info out of kibana, merge it into stack_stats.xpack.graph
return cluster;
diff --git a/x-pack/legacy/plugins/telemetry/server/collectors/monitoring/get_beats_stats.js b/x-pack/legacy/plugins/monitoring/server/telemetry_collection/get_beats_stats.js
similarity index 97%
rename from x-pack/legacy/plugins/telemetry/server/collectors/monitoring/get_beats_stats.js
rename to x-pack/legacy/plugins/monitoring/server/telemetry_collection/get_beats_stats.js
index b8688e8b7a55..247e4e991125 100644
--- a/x-pack/legacy/plugins/telemetry/server/collectors/monitoring/get_beats_stats.js
+++ b/x-pack/legacy/plugins/monitoring/server/telemetry_collection/get_beats_stats.js
@@ -6,7 +6,7 @@
import { get } from 'lodash';
import { createQuery } from './create_query';
-import { INDEX_PATTERN_BEATS } from '../../../../monitoring/common/constants';
+import { INDEX_PATTERN_BEATS } from '../../common/constants';
const HITS_SIZE = 10000; // maximum hits to receive from ES with each search
@@ -118,9 +118,13 @@ export function processResults(results = [], { clusters, clusterHostSets, cluste
clusterHb.monitors += heartbeatState.monitors;
clusterHb.endpoints += heartbeatState.endpoints;
for (const proto in heartbeatState) {
- if (!heartbeatState.hasOwnProperty(proto)) continue;
+ if (!heartbeatState.hasOwnProperty(proto)) {
+ continue;
+ }
const val = heartbeatState[proto];
- if (typeof val !== 'object') continue;
+ if (typeof val !== 'object') {
+ continue;
+ }
if (!clusterHb.hasOwnProperty(proto)) {
clusterHb[proto] = {
diff --git a/x-pack/legacy/plugins/telemetry/server/collectors/monitoring/get_cluster_uuids.js b/x-pack/legacy/plugins/monitoring/server/telemetry_collection/get_cluster_uuids.js
similarity index 96%
rename from x-pack/legacy/plugins/telemetry/server/collectors/monitoring/get_cluster_uuids.js
rename to x-pack/legacy/plugins/monitoring/server/telemetry_collection/get_cluster_uuids.js
index 9ea8de80e05d..9caf4cac50e0 100644
--- a/x-pack/legacy/plugins/telemetry/server/collectors/monitoring/get_cluster_uuids.js
+++ b/x-pack/legacy/plugins/monitoring/server/telemetry_collection/get_cluster_uuids.js
@@ -6,7 +6,7 @@
import { get } from 'lodash';
import { createQuery } from './create_query';
-import { INDEX_PATTERN_ELASTICSEARCH } from '../../../../monitoring/common/constants';
+import { INDEX_PATTERN_ELASTICSEARCH } from '../../common/constants';
/**
* Get a list of Cluster UUIDs that exist within the specified timespan.
diff --git a/x-pack/legacy/plugins/telemetry/server/collectors/monitoring/get_es_stats.js b/x-pack/legacy/plugins/monitoring/server/telemetry_collection/get_es_stats.js
similarity index 96%
rename from x-pack/legacy/plugins/telemetry/server/collectors/monitoring/get_es_stats.js
rename to x-pack/legacy/plugins/monitoring/server/telemetry_collection/get_es_stats.js
index 0a5487116533..f12c337c3060 100644
--- a/x-pack/legacy/plugins/telemetry/server/collectors/monitoring/get_es_stats.js
+++ b/x-pack/legacy/plugins/monitoring/server/telemetry_collection/get_es_stats.js
@@ -5,7 +5,7 @@
*/
import { get } from 'lodash';
-import { INDEX_PATTERN_ELASTICSEARCH } from '../../../../monitoring/common/constants';
+import { INDEX_PATTERN_ELASTICSEARCH } from '../../common/constants';
/**
* Get statistics for all selected Elasticsearch clusters.
diff --git a/x-pack/legacy/plugins/telemetry/server/collectors/monitoring/get_high_level_stats.js b/x-pack/legacy/plugins/monitoring/server/telemetry_collection/get_high_level_stats.js
similarity index 97%
rename from x-pack/legacy/plugins/telemetry/server/collectors/monitoring/get_high_level_stats.js
rename to x-pack/legacy/plugins/monitoring/server/telemetry_collection/get_high_level_stats.js
index ecd6ccc2d240..889efe37e7a8 100644
--- a/x-pack/legacy/plugins/telemetry/server/collectors/monitoring/get_high_level_stats.js
+++ b/x-pack/legacy/plugins/monitoring/server/telemetry_collection/get_high_level_stats.js
@@ -6,8 +6,16 @@
import { get } from 'lodash';
import { createQuery } from './create_query';
-import { INDEX_PATTERN_KIBANA, INDEX_PATTERN_BEATS, INDEX_PATTERN_LOGSTASH } from '../../../../monitoring/common/constants';
-import { KIBANA_SYSTEM_ID, BEATS_SYSTEM_ID, APM_SYSTEM_ID, LOGSTASH_SYSTEM_ID, TELEMETRY_QUERY_SOURCE } from '../../../common/constants';
+import {
+ INDEX_PATTERN_KIBANA,
+ INDEX_PATTERN_BEATS,
+ INDEX_PATTERN_LOGSTASH,
+ KIBANA_SYSTEM_ID,
+ BEATS_SYSTEM_ID,
+ APM_SYSTEM_ID,
+ LOGSTASH_SYSTEM_ID,
+ TELEMETRY_QUERY_SOURCE,
+} from '../../common/constants';
/**
* Update a counter associated with the {@code key}.
diff --git a/x-pack/legacy/plugins/telemetry/server/collectors/monitoring/get_kibana_stats.js b/x-pack/legacy/plugins/monitoring/server/telemetry_collection/get_kibana_stats.js
similarity index 98%
rename from x-pack/legacy/plugins/telemetry/server/collectors/monitoring/get_kibana_stats.js
rename to x-pack/legacy/plugins/monitoring/server/telemetry_collection/get_kibana_stats.js
index d92593811b4c..9364392ab33a 100644
--- a/x-pack/legacy/plugins/telemetry/server/collectors/monitoring/get_kibana_stats.js
+++ b/x-pack/legacy/plugins/monitoring/server/telemetry_collection/get_kibana_stats.js
@@ -5,7 +5,7 @@
*/
import { get, isEmpty, omit } from 'lodash';
-import { KIBANA_SYSTEM_ID } from '../../../common/constants';
+import { KIBANA_SYSTEM_ID } from '../../common/constants';
import { fetchHighLevelStats, handleHighLevelStatsResponse } from './get_high_level_stats';
export function rollUpTotals(rolledUp, addOn, field) {
diff --git a/x-pack/legacy/plugins/telemetry/server/collectors/get_stats.ts b/x-pack/legacy/plugins/monitoring/server/telemetry_collection/get_stats_with_monitoring.ts
similarity index 58%
rename from x-pack/legacy/plugins/telemetry/server/collectors/get_stats.ts
rename to x-pack/legacy/plugins/monitoring/server/telemetry_collection/get_stats_with_monitoring.ts
index 7b1af9e06b14..fdf46122f13b 100644
--- a/x-pack/legacy/plugins/telemetry/server/collectors/get_stats.ts
+++ b/x-pack/legacy/plugins/monitoring/server/telemetry_collection/get_stats_with_monitoring.ts
@@ -4,7 +4,9 @@
* you may not use this file except in compliance with the Elastic License.
*/
-import { getAllStats, getLocalStats } from './';
+// @ts-ignore
+import { getAllStats } from './get_all_stats';
+import { getStatsWithXpack } from '../../../xpack_main/server/telemetry_collection';
/**
* Get the telemetry data.
@@ -16,30 +18,25 @@ import { getAllStats, getLocalStats } from './';
* @param {Boolean} unencrypted Is the request payload going to be unencrypted.
* @return {Promise} An array of telemetry objects.
*/
-export async function getStats(
+export async function getStatsWithMonitoring(
req: any,
config: any,
start: string,
end: string,
- unencrypted: boolean,
- statsGetters: any = {}
+ unencrypted: boolean
) {
- const { _getAllStats = getAllStats, _getLocalStats = getLocalStats } = statsGetters;
let response = [];
const useInternalUser = !unencrypted;
- if (config.get('xpack.monitoring.enabled')) {
- try {
- // attempt to collect stats from multiple clusters in monitoring data
- response = await _getAllStats(req, start, end, { useInternalUser });
- } catch (err) {
- // no-op
- }
+ try {
+ // attempt to collect stats from multiple clusters in monitoring data
+ response = await getAllStats(req, start, end, { useInternalUser });
+ } catch (err) {
+ // no-op
}
if (!Array.isArray(response) || response.length === 0) {
- // return it as an array for a consistent API response
- response = [await _getLocalStats(req, { useInternalUser })];
+ response = await getStatsWithXpack(req, config, start, end, unencrypted);
}
return response;
diff --git a/x-pack/legacy/plugins/telemetry/server/collectors/encryption/index.ts b/x-pack/legacy/plugins/monitoring/server/telemetry_collection/index.ts
similarity index 77%
rename from x-pack/legacy/plugins/telemetry/server/collectors/encryption/index.ts
rename to x-pack/legacy/plugins/monitoring/server/telemetry_collection/index.ts
index 0c3ad5a5e301..db2301932cfd 100644
--- a/x-pack/legacy/plugins/telemetry/server/collectors/encryption/index.ts
+++ b/x-pack/legacy/plugins/monitoring/server/telemetry_collection/index.ts
@@ -4,4 +4,4 @@
* you may not use this file except in compliance with the Elastic License.
*/
-export { encryptTelemetry } from './encrypt';
+export { getStatsWithMonitoring } from './get_stats_with_monitoring';
diff --git a/x-pack/legacy/plugins/oss_telemetry/server/lib/collectors/csp/csp_collector.ts b/x-pack/legacy/plugins/oss_telemetry/server/lib/collectors/csp/csp_collector.ts
deleted file mode 100644
index 3bacde22bdbc..000000000000
--- a/x-pack/legacy/plugins/oss_telemetry/server/lib/collectors/csp/csp_collector.ts
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License;
- * you may not use this file except in compliance with the Elastic License.
- */
-
-import {
- createCSPRuleString,
- DEFAULT_CSP_RULES,
-} from '../../../../../../../../src/legacy/server/csp';
-import { HapiServer } from '../../../../';
-
-export function createCspCollector(server: HapiServer) {
- return {
- type: 'csp',
- isReady: () => true,
- async fetch() {
- const config = server.config();
-
- // It's important that we do not send the value of csp.rules here as it
- // can be customized with values that can be identifiable to given
- // installs, such as URLs
- const defaultRulesString = createCSPRuleString([...DEFAULT_CSP_RULES]);
- const actualRulesString = createCSPRuleString(config.get('csp.rules'));
-
- return {
- strict: config.get('csp.strict'),
- warnLegacyBrowsers: config.get('csp.warnLegacyBrowsers'),
- rulesChangedFromDefault: defaultRulesString !== actualRulesString,
- };
- },
- };
-}
-
-export function registerCspCollector(server: HapiServer): void {
- const { usage } = server;
- const collector = usage.collectorSet.makeUsageCollector(createCspCollector(server));
- usage.collectorSet.register(collector);
-}
diff --git a/x-pack/legacy/plugins/oss_telemetry/server/lib/collectors/index.ts b/x-pack/legacy/plugins/oss_telemetry/server/lib/collectors/index.ts
index abe96fe061fa..8b825b13178f 100644
--- a/x-pack/legacy/plugins/oss_telemetry/server/lib/collectors/index.ts
+++ b/x-pack/legacy/plugins/oss_telemetry/server/lib/collectors/index.ts
@@ -5,10 +5,8 @@
*/
import { HapiServer } from '../../../';
-import { registerCspCollector } from './csp';
import { registerVisualizationsCollector } from './visualizations/register_usage_collector';
export function registerCollectors(server: HapiServer) {
registerVisualizationsCollector(server);
- registerCspCollector(server);
}
diff --git a/x-pack/legacy/plugins/telemetry/common/constants.ts b/x-pack/legacy/plugins/telemetry/common/constants.ts
deleted file mode 100644
index c50f36ac9449..000000000000
--- a/x-pack/legacy/plugins/telemetry/common/constants.ts
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License;
- * you may not use this file except in compliance with the Elastic License.
- */
-
-import { i18n } from '@kbn/i18n';
-
-/*
- * config options opt into telemetry
- * @type {string}
- */
-export const CONFIG_TELEMETRY = 'telemetry:optIn';
-/*
- * config description for opting into telemetry
- * @type {string}
- */
-export const getConfigTelemetryDesc = () => {
- return i18n.translate('xpack.telemetry.telemetryConfigDescription', {
- defaultMessage:
- 'Help us improve the Elastic Stack by providing usage statistics for basic features. We will not share this data outside of Elastic.',
- });
-};
-
-/**
- * The name of the Kibana System ID used to publish and look up Kibana stats through the Monitoring system.
- * @type {string}
- */
-export const KIBANA_SYSTEM_ID = 'kibana';
-
-/**
- * The name of the Beats System ID used to publish and look up Beats stats through the Monitoring system.
- * @type {string}
- */
-export const BEATS_SYSTEM_ID = 'beats';
-
-/**
- * The name of the Apm System ID used to publish and look up Apm stats through the Monitoring system.
- * @type {string}
- */
-export const APM_SYSTEM_ID = 'beats';
-
-/**
- * The name of the Kibana System ID used to look up Logstash stats through the Monitoring system.
- * @type {string}
- */
-export const LOGSTASH_SYSTEM_ID = 'logstash';
-
-/**
- * The name of the Kibana System ID used to look up Reporting stats through the Monitoring system.
- * @type {string}
- */
-export const REPORTING_SYSTEM_ID = 'reporting';
-
-/**
- * The amount of time, in milliseconds, to wait between reports when enabled.
- *
- * Currently 24 hours.
- * @type {Number}
- */
-export const REPORT_INTERVAL_MS = 86400000;
-
-/*
- * Key for the localStorage service
- */
-export const LOCALSTORAGE_KEY = 'xpack.data';
-
-/**
- * Link to the Elastic Telemetry privacy statement.
- */
-export const PRIVACY_STATEMENT_URL = `https://www.elastic.co/legal/telemetry-privacy-statement`;
-
-/**
- * The type name used within the Monitoring index to publish localization stats.
- * @type {string}
- */
-export const KIBANA_LOCALIZATION_STATS_TYPE = 'localization';
-
-/**
- * The header sent by telemetry service when hitting Elasticsearch to identify query source
- * @type {string}
- */
-export const TELEMETRY_QUERY_SOURCE = 'TELEMETRY';
-
-/**
- * UI metric usage type
- * @type {string}
- */
-export const UI_METRIC_USAGE_TYPE = 'ui_metric';
diff --git a/x-pack/legacy/plugins/telemetry/common/get_xpack_config_with_deprecated.ts b/x-pack/legacy/plugins/telemetry/common/get_xpack_config_with_deprecated.ts
deleted file mode 100644
index 9fa8ead5c8a0..000000000000
--- a/x-pack/legacy/plugins/telemetry/common/get_xpack_config_with_deprecated.ts
+++ /dev/null
@@ -1,15 +0,0 @@
-/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License;
- * you may not use this file except in compliance with the Elastic License.
- */
-
-import { KibanaConfig } from 'src/legacy/server/kbn_server';
-
-export function getXpackConfigWithDeprecated(config: KibanaConfig, configPath: string) {
- const deprecatedConfig = config.get(`xpack.xpack_main.${configPath}`);
- if (typeof deprecatedConfig !== 'undefined') {
- return deprecatedConfig;
- }
- return config.get(`xpack.${configPath}`);
-}
diff --git a/x-pack/legacy/plugins/telemetry/public/components/index.ts b/x-pack/legacy/plugins/telemetry/public/components/index.ts
deleted file mode 100644
index 9675bd997b18..000000000000
--- a/x-pack/legacy/plugins/telemetry/public/components/index.ts
+++ /dev/null
@@ -1,11 +0,0 @@
-/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License;
- * you may not use this file except in compliance with the Elastic License.
- */
-
-// @ts-ignore
-export { TelemetryForm } from './telemetry_form';
-export { OptInExampleFlyout } from './opt_in_details_component';
-export { OptInBanner } from './opt_in_banner_component';
-export { OptInMessage } from './opt_in_message';
diff --git a/x-pack/legacy/plugins/telemetry/public/components/opt_in_details_component.test.tsx b/x-pack/legacy/plugins/telemetry/public/components/opt_in_details_component.test.tsx
deleted file mode 100644
index c58927c66756..000000000000
--- a/x-pack/legacy/plugins/telemetry/public/components/opt_in_details_component.test.tsx
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License;
- * you may not use this file except in compliance with the Elastic License.
- */
-import React from 'react';
-import { shallowWithIntl } from 'test_utils/enzyme_helpers';
-import { OptInExampleFlyout } from './opt_in_details_component';
-
-describe('OptInDetailsComponent', () => {
- it('renders as expected', () => {
- expect(
- shallowWithIntl(
- ({ data: [] }))}
- onClose={jest.fn()}
- />
- )
- ).toMatchSnapshot();
- });
-});
diff --git a/x-pack/legacy/plugins/telemetry/public/components/opt_in_details_component.tsx b/x-pack/legacy/plugins/telemetry/public/components/opt_in_details_component.tsx
deleted file mode 100644
index 9cfb55af1dab..000000000000
--- a/x-pack/legacy/plugins/telemetry/public/components/opt_in_details_component.tsx
+++ /dev/null
@@ -1,150 +0,0 @@
-/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License;
- * you may not use this file except in compliance with the Elastic License.
- */
-
-import * as React from 'react';
-
-import {
- EuiCallOut,
- EuiCodeBlock,
- EuiFlexGroup,
- EuiFlexItem,
- EuiFlyout,
- EuiFlyoutHeader,
- EuiFlyoutBody,
- EuiLoadingSpinner,
- EuiPortal, // EuiPortal is a temporary requirement to use EuiFlyout with "ownFocus"
- EuiText,
- EuiTextColor,
- EuiTitle,
-} from '@elastic/eui';
-
-import { FormattedMessage } from '@kbn/i18n/react';
-
-interface Props {
- fetchTelemetry: () => Promise;
- onClose: () => void;
-}
-
-interface State {
- isLoading: boolean;
- hasPrivilegeToRead: boolean;
- data: any[] | null;
-}
-
-/**
- * React component for displaying the example data associated with the Telemetry opt-in banner.
- */
-export class OptInExampleFlyout extends React.PureComponent {
- public readonly state: State = {
- data: null,
- isLoading: true,
- hasPrivilegeToRead: false,
- };
-
- componentDidMount() {
- this.props
- .fetchTelemetry()
- .then(response =>
- this.setState({
- data: Array.isArray(response.data) ? response.data : null,
- isLoading: false,
- hasPrivilegeToRead: true,
- })
- )
- .catch(err => {
- this.setState({
- isLoading: false,
- hasPrivilegeToRead: err.status !== 403,
- });
- });
- }
-
- renderBody({ data, isLoading, hasPrivilegeToRead }: State) {
- if (isLoading) {
- return (
-
-
-
-
-
- );
- }
-
- if (!hasPrivilegeToRead) {
- return (
-
- }
- color="danger"
- iconType="cross"
- >
-
-
- );
- }
-
- if (data === null) {
- return (
-
- }
- color="danger"
- iconType="cross"
- >
-
-
- );
- }
-
- return {JSON.stringify(data, null, 2)};
- }
-
- render() {
- return (
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {this.renderBody(this.state)}
-
-
- );
- }
-}
diff --git a/x-pack/legacy/plugins/telemetry/public/components/opt_in_message.tsx b/x-pack/legacy/plugins/telemetry/public/components/opt_in_message.tsx
deleted file mode 100644
index 5be20f8de32c..000000000000
--- a/x-pack/legacy/plugins/telemetry/public/components/opt_in_message.tsx
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License;
- * you may not use this file except in compliance with the Elastic License.
- */
-
-import * as React from 'react';
-import { EuiLink, EuiText } from '@elastic/eui';
-import { FormattedMessage } from '@kbn/i18n/react';
-
-import { getConfigTelemetryDesc, PRIVACY_STATEMENT_URL } from '../../common/constants';
-import { OptInExampleFlyout } from './opt_in_details_component';
-
-interface Props {
- fetchTelemetry: () => Promise;
-}
-
-interface State {
- showDetails: boolean;
- showExample: boolean;
-}
-
-export class OptInMessage extends React.PureComponent {
- public readonly state: State = {
- showDetails: false,
- showExample: false,
- };
-
- toggleShowExample = () => {
- this.setState(prevState => ({
- showExample: !prevState.showExample,
- }));
- };
-
- render() {
- const { showDetails, showExample } = this.state;
-
- const getDetails = () => (
-
-
-
-
-
- ),
- telemetryPrivacyStatementLink: (
-
-
-
- ),
- }}
- />
-
-
- );
-
- const getFlyoutDetails = () => (
- this.setState({ showExample: false })}
- fetchTelemetry={this.props.fetchTelemetry}
- />
- );
-
- const getReadMore = () => (
- this.setState({ showDetails: true })}>
-
-
- );
-
- return (
-
-
-
- {getConfigTelemetryDesc()} {!showDetails && getReadMore()}
-
-
- {showDetails && getDetails()}
- {showDetails && showExample && getFlyoutDetails()}
-
- );
- }
-}
diff --git a/x-pack/legacy/plugins/telemetry/public/hacks/__tests__/telemetry.js b/x-pack/legacy/plugins/telemetry/public/hacks/__tests__/telemetry.js
deleted file mode 100644
index 2c14538d7737..000000000000
--- a/x-pack/legacy/plugins/telemetry/public/hacks/__tests__/telemetry.js
+++ /dev/null
@@ -1,15 +0,0 @@
-/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License;
- * you may not use this file except in compliance with the Elastic License.
- */
-
-import { uiModules } from 'ui/modules';
-
-// This overrides settings for other UI tests
-uiModules.get('kibana')
- // disable stat reporting while running tests,
- // MockInjector used in these tests is not impacted
- .constant('telemetryEnabled', false)
- .constant('telemetryOptedIn', null)
- .constant('telemetryUrl', 'not.a.valid.url.0');
diff --git a/x-pack/legacy/plugins/telemetry/public/hacks/fetch_telemetry.js b/x-pack/legacy/plugins/telemetry/public/hacks/fetch_telemetry.js
deleted file mode 100644
index ced23c58566b..000000000000
--- a/x-pack/legacy/plugins/telemetry/public/hacks/fetch_telemetry.js
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License;
- * you may not use this file except in compliance with the Elastic License.
- */
-
-import uiChrome from 'ui/chrome';
-import moment from 'moment';
-
-/**
- * Fetch Telemetry data by calling the Kibana API.
- *
- * @param {Object} $http The HTTP handler
- * @param {String} basePath The base URI
- * @param {Function} _moment moment.js, but injectable for tests
- * @return {Promise} An array of cluster Telemetry objects.
- */
-export function fetchTelemetry($http, { basePath = uiChrome.getBasePath(), _moment = moment, unencrypted = false } = { }) {
- return $http.post(`${basePath}/api/telemetry/v2/clusters/_stats`, {
- unencrypted,
- timeRange: {
- min: _moment().subtract(20, 'minutes').toISOString(),
- max: _moment().toISOString()
- }
- });
-}
diff --git a/x-pack/legacy/plugins/telemetry/public/hacks/telemetry_init.ts b/x-pack/legacy/plugins/telemetry/public/hacks/telemetry_init.ts
deleted file mode 100644
index c44da2b36bf1..000000000000
--- a/x-pack/legacy/plugins/telemetry/public/hacks/telemetry_init.ts
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License;
- * you may not use this file except in compliance with the Elastic License.
- */
-
-// @ts-ignore
-import { uiModules } from 'ui/modules';
-// @ts-ignore
-import { Path } from 'plugins/xpack_main/services/path';
-// @ts-ignore
-import { npStart } from 'ui/new_platform';
-// @ts-ignore
-import { Telemetry } from './telemetry';
-// @ts-ignore
-import { fetchTelemetry } from './fetch_telemetry';
-
-function telemetryInit($injector: any) {
- const $http = $injector.get('$http');
-
- const telemetryEnabled = npStart.core.injectedMetadata.getInjectedVar('telemetryEnabled');
-
- if (telemetryEnabled) {
- // no telemetry for non-logged in users
- if (Path.isUnauthenticated()) {
- return;
- }
-
- const sender = new Telemetry($injector, () => fetchTelemetry($http));
- sender.start();
- }
-}
-
-uiModules.get('telemetry/hacks').run(telemetryInit);
diff --git a/x-pack/legacy/plugins/telemetry/public/hacks/telemetry_opt_in.js b/x-pack/legacy/plugins/telemetry/public/hacks/telemetry_opt_in.js
deleted file mode 100644
index a7c36516d004..000000000000
--- a/x-pack/legacy/plugins/telemetry/public/hacks/telemetry_opt_in.js
+++ /dev/null
@@ -1,11 +0,0 @@
-/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License;
- * you may not use this file except in compliance with the Elastic License.
- */
-
-import { uiModules } from 'ui/modules';
-
-import { injectBanner } from './welcome_banner';
-
-uiModules.get('telemetry/hacks').run(injectBanner);
diff --git a/x-pack/legacy/plugins/telemetry/public/hacks/welcome_banner/index.js b/x-pack/legacy/plugins/telemetry/public/hacks/welcome_banner/index.js
deleted file mode 100644
index 2eabe7496b1f..000000000000
--- a/x-pack/legacy/plugins/telemetry/public/hacks/welcome_banner/index.js
+++ /dev/null
@@ -1,7 +0,0 @@
-/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License;
- * you may not use this file except in compliance with the Elastic License.
- */
-
-export { injectBanner } from './inject_banner';
diff --git a/x-pack/legacy/plugins/telemetry/public/hacks/welcome_banner/render_banner.test.js b/x-pack/legacy/plugins/telemetry/public/hacks/welcome_banner/render_banner.test.js
deleted file mode 100644
index a55027703f95..000000000000
--- a/x-pack/legacy/plugins/telemetry/public/hacks/welcome_banner/render_banner.test.js
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License;
- * you may not use this file except in compliance with the Elastic License.
- */
-
-import { renderBanner } from './render_banner';
-
-describe('render_banner', () => {
-
- it('adds a banner to banners with priority of 10000', () => {
- const bannerID = 'brucer-banner';
-
- const telemetryOptInProvider = { setBannerId: jest.fn() };
- const banners = { add: jest.fn().mockReturnValue(bannerID) };
- const fetchTelemetry = jest.fn();
-
- renderBanner(telemetryOptInProvider, fetchTelemetry, { _banners: banners });
-
- expect(banners.add).toBeCalledTimes(1);
- expect(fetchTelemetry).toBeCalledTimes(0);
- expect(telemetryOptInProvider.setBannerId).toBeCalledWith(bannerID);
-
- const bannerConfig = banners.add.mock.calls[0][0];
-
- expect(bannerConfig.component).not.toBe(undefined);
- expect(bannerConfig.priority).toBe(10000);
- });
-
-});
diff --git a/x-pack/legacy/plugins/telemetry/public/hacks/welcome_banner/should_show_banner.js b/x-pack/legacy/plugins/telemetry/public/hacks/welcome_banner/should_show_banner.js
deleted file mode 100644
index 5685132a9506..000000000000
--- a/x-pack/legacy/plugins/telemetry/public/hacks/welcome_banner/should_show_banner.js
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License;
- * you may not use this file except in compliance with the Elastic License.
- */
-
-import { handleOldSettings } from './handle_old_settings';
-
-/**
- * Determine if the banner should be displayed.
- *
- * This method can have side-effects related to deprecated config settings.
- *
- * @param {Object} config The advanced settings config object.
- * @param {Object} _handleOldSettings handleOldSettings function, but overridable for tests.
- * @return {Boolean} {@code true} if the banner should be displayed. {@code false} otherwise.
- */
-export async function shouldShowBanner(telemetryOptInProvider, config, { _handleOldSettings = handleOldSettings } = {}) {
- return telemetryOptInProvider.getOptIn() === null && await _handleOldSettings(config, telemetryOptInProvider);
-}
diff --git a/x-pack/legacy/plugins/telemetry/public/services/telemetry_opt_in.test.mocks.js b/x-pack/legacy/plugins/telemetry/public/services/telemetry_opt_in.test.mocks.js
deleted file mode 100644
index 63bfcb4b2a32..000000000000
--- a/x-pack/legacy/plugins/telemetry/public/services/telemetry_opt_in.test.mocks.js
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License;
- * you may not use this file except in compliance with the Elastic License.
- */
-
-import { injectedMetadataServiceMock } from '../../../../../../src/core/public/mocks';
-const injectedMetadataMock = injectedMetadataServiceMock.createStartContract();
-
-export function mockInjectedMetadata({ telemetryOptedIn }) {
- const mockGetInjectedVar = jest.fn().mockImplementation((key) => {
- switch (key) {
- case 'telemetryOptedIn': return telemetryOptedIn;
- default: throw new Error(`unexpected injectedVar ${key}`);
- }
- });
-
- injectedMetadataMock.getInjectedVar = mockGetInjectedVar;
-}
-
-jest.doMock('ui/new_platform', () => ({
- npStart: {
- core: {
- injectedMetadata: injectedMetadataMock
- },
- },
-}));
diff --git a/x-pack/legacy/plugins/telemetry/public/services/telemetry_opt_in.ts b/x-pack/legacy/plugins/telemetry/public/services/telemetry_opt_in.ts
deleted file mode 100644
index 9c1bfde1d27b..000000000000
--- a/x-pack/legacy/plugins/telemetry/public/services/telemetry_opt_in.ts
+++ /dev/null
@@ -1,8 +0,0 @@
-/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License;
- * you may not use this file except in compliance with the Elastic License.
- */
-
-// @ts-ignore
-export { TelemetryOptInProvider } from '../../../../../../src/legacy/core_plugins/kibana/public/home/telemetry_opt_in'; // eslint-disable-line
diff --git a/x-pack/legacy/plugins/telemetry/public/views/management/index.js b/x-pack/legacy/plugins/telemetry/public/views/management/index.js
deleted file mode 100644
index 0ed6fe09ef80..000000000000
--- a/x-pack/legacy/plugins/telemetry/public/views/management/index.js
+++ /dev/null
@@ -1,7 +0,0 @@
-/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License;
- * you may not use this file except in compliance with the Elastic License.
- */
-
-import './management';
diff --git a/x-pack/legacy/plugins/telemetry/public/views/management/management.js b/x-pack/legacy/plugins/telemetry/public/views/management/management.js
deleted file mode 100644
index 9e580f109d53..000000000000
--- a/x-pack/legacy/plugins/telemetry/public/views/management/management.js
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License;
- * you may not use this file except in compliance with the Elastic License.
- */
-import React from 'react';
-import routes from 'ui/routes';
-
-import { registerSettingsComponent, PAGE_FOOTER_COMPONENT } from 'ui/management';
-import { TelemetryOptInProvider } from '../../services/telemetry_opt_in';
-import { TelemetryForm } from '../../components';
-
-routes.defaults(/\/management/, {
- resolve: {
- telemetryManagementSection: function (Private, spacesEnabled, activeSpace) {
- const telemetryOptInProvider = Private(TelemetryOptInProvider);
-
- const spaceProps = {
- spacesEnabled,
- };
-
- if (spacesEnabled) {
- spaceProps.activeSpace = activeSpace ? activeSpace.space : null;
- }
-
- const Component = (props) => (
-
- );
-
- registerSettingsComponent(PAGE_FOOTER_COMPONENT, Component, true);
- }
- }
-});
diff --git a/x-pack/legacy/plugins/telemetry/server/collectors/encryption/encrypt.ts b/x-pack/legacy/plugins/telemetry/server/collectors/encryption/encrypt.ts
deleted file mode 100644
index 8907292df844..000000000000
--- a/x-pack/legacy/plugins/telemetry/server/collectors/encryption/encrypt.ts
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License;
- * you may not use this file except in compliance with the Elastic License.
- */
-
-import { createRequestEncryptor } from '@elastic/request-crypto';
-import { telemetryJWKS } from './telemetry_jwks';
-
-export function getKID(isProd = false): string {
- return isProd ? 'kibana' : 'kibana_dev';
-}
-
-export async function encryptTelemetry(payload: any, isProd = false): Promise {
- const kid = getKID(isProd);
- const encryptor = await createRequestEncryptor(telemetryJWKS);
- const clusters = [].concat(payload);
- return Promise.all(clusters.map((cluster: any) => encryptor.encrypt(kid, cluster)));
-}
diff --git a/x-pack/legacy/plugins/telemetry/server/collectors/index.ts b/x-pack/legacy/plugins/telemetry/server/collectors/index.ts
deleted file mode 100644
index c9b94a8ea5d5..000000000000
--- a/x-pack/legacy/plugins/telemetry/server/collectors/index.ts
+++ /dev/null
@@ -1,15 +0,0 @@
-/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License;
- * you may not use this file except in compliance with the Elastic License.
- */
-
-// @ts-ignore
-export { getAllStats } from './monitoring';
-// @ts-ignore
-export { getLocalStats } from './local';
-export { getStats } from './get_stats';
-export { encryptTelemetry } from './encryption';
-export { createTelemetryUsageCollector } from './usage';
-export { createUiMetricUsageCollector } from './ui_metric';
-export { createLocalizationUsageCollector } from './localization';
diff --git a/x-pack/legacy/plugins/telemetry/server/collectors/local/__tests__/get_cluster_info.js b/x-pack/legacy/plugins/telemetry/server/collectors/local/__tests__/get_cluster_info.js
deleted file mode 100644
index dfe7998718a9..000000000000
--- a/x-pack/legacy/plugins/telemetry/server/collectors/local/__tests__/get_cluster_info.js
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License;
- * you may not use this file except in compliance with the Elastic License.
- */
-
-import expect from '@kbn/expect';
-import sinon from 'sinon';
-
-import { getClusterInfo } from '../get_cluster_info';
-
-export function mockGetClusterInfo(callCluster, clusterInfo, req) {
- callCluster.withArgs(req, 'info').returns(clusterInfo);
- callCluster.withArgs('info').returns(clusterInfo);
-}
-
-describe('get_cluster_info', () => {
-
- it('uses callCluster to get info API', () => {
- const callCluster = sinon.stub();
- const response = Promise.resolve({});
-
- mockGetClusterInfo(callCluster, response);
-
- expect(getClusterInfo(callCluster)).to.be(response);
- });
-
-});
diff --git a/x-pack/legacy/plugins/telemetry/server/collectors/local/__tests__/get_cluster_stats.js b/x-pack/legacy/plugins/telemetry/server/collectors/local/__tests__/get_cluster_stats.js
deleted file mode 100644
index 29e7e620e331..000000000000
--- a/x-pack/legacy/plugins/telemetry/server/collectors/local/__tests__/get_cluster_stats.js
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License;
- * you may not use this file except in compliance with the Elastic License.
- */
-
-import expect from '@kbn/expect';
-import sinon from 'sinon';
-
-import { TIMEOUT } from '../constants';
-import { getClusterStats } from '../get_cluster_stats';
-
-export function mockGetClusterStats(callCluster, clusterStats, req) {
- callCluster.withArgs(req, 'cluster.stats', {
- timeout: TIMEOUT
- })
- .returns(clusterStats);
-
- callCluster.withArgs('cluster.stats', {
- timeout: TIMEOUT
- })
- .returns(clusterStats);
-}
-
-describe('get_cluster_stats', () => {
-
- it('uses callCluster to get cluster.stats API', () => {
- const callCluster = sinon.stub();
- const response = Promise.resolve({});
-
- mockGetClusterStats(callCluster, response);
-
- expect(getClusterStats(callCluster)).to.be(response);
- });
-
-});
diff --git a/x-pack/legacy/plugins/telemetry/server/collectors/local/get_cluster_info.js b/x-pack/legacy/plugins/telemetry/server/collectors/local/get_cluster_info.js
deleted file mode 100644
index 550af3692b97..000000000000
--- a/x-pack/legacy/plugins/telemetry/server/collectors/local/get_cluster_info.js
+++ /dev/null
@@ -1,17 +0,0 @@
-/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License;
- * you may not use this file except in compliance with the Elastic License.
- */
-
-/**
- * Get the cluster info from the connected cluster.
- *
- * This is the equivalent to GET /
- *
- * @param {function} callCluster The callWithInternalUser handler (exposed for testing)
- * @return {Promise} The response from Elasticsearch.
- */
-export function getClusterInfo(callCluster) {
- return callCluster('info');
-}
diff --git a/x-pack/legacy/plugins/telemetry/server/collectors/local/get_cluster_stats.js b/x-pack/legacy/plugins/telemetry/server/collectors/local/get_cluster_stats.js
deleted file mode 100644
index 34152f8fea4e..000000000000
--- a/x-pack/legacy/plugins/telemetry/server/collectors/local/get_cluster_stats.js
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License;
- * you may not use this file except in compliance with the Elastic License.
- */
-
-import { TIMEOUT } from './constants';
-
-/**
- * Get the cluster stats from the connected cluster.
- *
- * This is the equivalent to GET /_cluster/stats?timeout=30s.
- *
- * @param {function} callCluster The callWithInternalUser handler (exposed for testing)
- * @return {Promise} The response from Elasticsearch equivalent to GET /_cluster/stats.
- */
-export function getClusterStats(callCluster) {
- return callCluster('cluster.stats', {
- timeout: TIMEOUT
- });
-}
diff --git a/x-pack/legacy/plugins/telemetry/server/collectors/local/get_kibana.js b/x-pack/legacy/plugins/telemetry/server/collectors/local/get_kibana.js
deleted file mode 100644
index 50e68e2b74d6..000000000000
--- a/x-pack/legacy/plugins/telemetry/server/collectors/local/get_kibana.js
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License;
- * you may not use this file except in compliance with the Elastic License.
- */
-
-import { get, omit } from 'lodash';
-
-export function handleKibanaStats(server, response) {
- if (!response) {
- server.log(['warning', 'telemetry', 'local-stats'], 'No Kibana stats returned from usage collectors');
- return;
- }
-
- const { kibana, kibana_stats: stats, ...plugins } = response;
-
- const platform = get(stats, 'os.platform', 'unknown');
- const platformRelease = get(stats, 'os.platformRelease', 'unknown');
-
- let version;
- const { kbnServer } = get(server, 'plugins.xpack_main.status.plugin');
- if (kbnServer) {
- version = kbnServer.version.replace(/-snapshot/i, '');
- }
-
- // combine core stats (os types, saved objects) with plugin usage stats
- // organize the object into the same format as monitoring-enabled telemetry
- return {
- ...omit(kibana, 'index'), // discard index
- count: 1,
- indices: 1,
- os: {
- platforms: [{ platform, count: 1 }],
- platformReleases: [{ platformRelease, count: 1 }],
- },
- versions: [{ version, count: 1 }],
- plugins,
- };
-}
-
-/*
- * Check user privileges for read access to monitoring
- * Pass callWithInternalUser to bulkFetchUsage
- */
-export async function getKibana(server, callWithInternalUser) {
- const { collectorSet } = server.usage;
- const usage = await collectorSet.bulkFetch(callWithInternalUser);
- return collectorSet.toObject(usage);
-}
diff --git a/x-pack/legacy/plugins/telemetry/server/collectors/local/index.js b/x-pack/legacy/plugins/telemetry/server/collectors/local/index.js
deleted file mode 100644
index b78fca22c1af..000000000000
--- a/x-pack/legacy/plugins/telemetry/server/collectors/local/index.js
+++ /dev/null
@@ -1,7 +0,0 @@
-/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License;
- * you may not use this file except in compliance with the Elastic License.
- */
-
-export { getLocalStats } from './get_local_stats';
diff --git a/x-pack/legacy/plugins/telemetry/server/collectors/localization/file_integrity.test.mocks.ts b/x-pack/legacy/plugins/telemetry/server/collectors/localization/file_integrity.test.mocks.ts
deleted file mode 100644
index 36f76516e188..000000000000
--- a/x-pack/legacy/plugins/telemetry/server/collectors/localization/file_integrity.test.mocks.ts
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License;
- * you may not use this file except in compliance with the Elastic License.
- */
-
-import { Readable } from 'stream';
-
-jest.doMock('fs', () => ({
- createReadStream(filepath: string): Readable {
- if (filepath === 'ERROR') {
- throw new Error('MOCK ERROR - Invalid Path');
- }
- const readableStream = new Readable();
- const streamData = filepath.split('');
- let cursor = 0;
-
- readableStream._read = function(size) {
- const current = streamData[cursor++];
- if (typeof current === 'undefined') {
- return this.push(null);
- }
- this.push(current);
- };
-
- return readableStream;
- },
-}));
diff --git a/x-pack/legacy/plugins/telemetry/server/collectors/localization/index.ts b/x-pack/legacy/plugins/telemetry/server/collectors/localization/index.ts
deleted file mode 100644
index dd8a3a9a1040..000000000000
--- a/x-pack/legacy/plugins/telemetry/server/collectors/localization/index.ts
+++ /dev/null
@@ -1,7 +0,0 @@
-/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License;
- * you may not use this file except in compliance with the Elastic License.
- */
-
-export { createLocalizationUsageCollector } from './telemetry_localization_collector';
diff --git a/x-pack/legacy/plugins/telemetry/server/collectors/monitoring/index.js b/x-pack/legacy/plugins/telemetry/server/collectors/monitoring/index.js
deleted file mode 100644
index 4500385367d1..000000000000
--- a/x-pack/legacy/plugins/telemetry/server/collectors/monitoring/index.js
+++ /dev/null
@@ -1,7 +0,0 @@
-/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License;
- * you may not use this file except in compliance with the Elastic License.
- */
-
-export { getAllStats } from './get_all_stats';
diff --git a/x-pack/legacy/plugins/telemetry/server/collectors/ui_metric/index.ts b/x-pack/legacy/plugins/telemetry/server/collectors/ui_metric/index.ts
deleted file mode 100644
index f5a49587d49c..000000000000
--- a/x-pack/legacy/plugins/telemetry/server/collectors/ui_metric/index.ts
+++ /dev/null
@@ -1,7 +0,0 @@
-/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License;
- * you may not use this file except in compliance with the Elastic License.
- */
-
-export { createUiMetricUsageCollector } from './telemetry_ui_metric_collector';
diff --git a/x-pack/legacy/plugins/telemetry/server/collectors/usage/index.ts b/x-pack/legacy/plugins/telemetry/server/collectors/usage/index.ts
deleted file mode 100644
index 960fed00152b..000000000000
--- a/x-pack/legacy/plugins/telemetry/server/collectors/usage/index.ts
+++ /dev/null
@@ -1,7 +0,0 @@
-/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License;
- * you may not use this file except in compliance with the Elastic License.
- */
-
-export { createTelemetryUsageCollector } from './telemetry_usage_collector';
diff --git a/x-pack/legacy/plugins/telemetry/server/index.ts b/x-pack/legacy/plugins/telemetry/server/index.ts
deleted file mode 100644
index 5748106be8b2..000000000000
--- a/x-pack/legacy/plugins/telemetry/server/index.ts
+++ /dev/null
@@ -1,14 +0,0 @@
-/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License;
- * you may not use this file except in compliance with the Elastic License.
- */
-
-import { PluginInitializerContext } from 'src/core/server';
-import { TelemetryPlugin } from './plugin';
-import * as constants from '../common/constants';
-
-export { getTelemetryOptIn } from './get_telemetry_opt_in';
-export const telemetryPlugin = (initializerContext: PluginInitializerContext) =>
- new TelemetryPlugin();
-export { constants };
diff --git a/x-pack/legacy/plugins/telemetry/server/plugin.ts b/x-pack/legacy/plugins/telemetry/server/plugin.ts
deleted file mode 100644
index 13aeb774d4a6..000000000000
--- a/x-pack/legacy/plugins/telemetry/server/plugin.ts
+++ /dev/null
@@ -1,14 +0,0 @@
-/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License;
- * you may not use this file except in compliance with the Elastic License.
- */
-
-import { CoreSetup } from 'src/core/server';
-import { registerRoutes } from './routes';
-
-export class TelemetryPlugin {
- public setup(core: CoreSetup) {
- registerRoutes(core);
- }
-}
diff --git a/x-pack/legacy/plugins/telemetry/server/routes/index.ts b/x-pack/legacy/plugins/telemetry/server/routes/index.ts
deleted file mode 100644
index f6880b644699..000000000000
--- a/x-pack/legacy/plugins/telemetry/server/routes/index.ts
+++ /dev/null
@@ -1,14 +0,0 @@
-/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License;
- * you may not use this file except in compliance with the Elastic License.
- */
-
-import { CoreSetup } from 'src/core/server';
-import { registerOptInRoutes } from './opt_in';
-import { registerTelemetryDataRoutes } from './telemetry_stats';
-
-export function registerRoutes(core: CoreSetup) {
- registerOptInRoutes(core);
- registerTelemetryDataRoutes(core);
-}
diff --git a/x-pack/legacy/plugins/xpack_main/index.js b/x-pack/legacy/plugins/xpack_main/index.js
index ad8220c1ece6..3cfd96aa2778 100644
--- a/x-pack/legacy/plugins/xpack_main/index.js
+++ b/x-pack/legacy/plugins/xpack_main/index.js
@@ -10,7 +10,6 @@ import {
XPACK_DEFAULT_ADMIN_EMAIL_UI_SETTING,
XPACK_INFO_API_DEFAULT_POLL_FREQUENCY_IN_MILLIS
} from '../../server/lib/constants';
-import { getXpackConfigWithDeprecated } from '../telemetry/common/get_xpack_config_with_deprecated';
import { mirrorPluginStatus } from '../../server/lib/mirror_plugin_status';
import { replaceInjectedVars } from './server/lib/replace_injected_vars';
import { setupXPackMain } from './server/lib/setup_xpack_main';
@@ -19,15 +18,10 @@ import { i18n } from '@kbn/i18n';
import { has } from 'lodash';
-function movedToTelemetry(configPath) {
- return (settings, log) => {
- if (has(settings, configPath)) {
- log(`Config key ${configPath} is deprecated. Use "xpack.telemetry.${configPath}" instead.`);
- }
- };
-}
-
export { callClusterFactory } from './server/lib/call_cluster_factory';
+import { getStatsWithXpack } from './server/telemetry_collection';
+import { telemetryCollectionManager } from '../../../../src/legacy/core_plugins/telemetry/server';
+
export const xpackMain = (kibana) => {
return new kibana.Plugin({
id: 'xpack_main',
@@ -78,7 +72,6 @@ export const xpackMain = (kibana) => {
const config = server.config();
return {
- telemetryEnabled: getXpackConfigWithDeprecated(config, 'telemetry.enabled'),
activeSpace: null,
spacesEnabled: config.get('xpack.spaces.enabled'),
};
@@ -102,6 +95,8 @@ export const xpackMain = (kibana) => {
mirrorPluginStatus(server.plugins.elasticsearch, this, 'yellow', 'red');
+ telemetryCollectionManager.setStatsGetter(getStatsWithXpack, 'local_xpack', 1);
+
featuresPlugin.registerLegacyAPI({
xpackInfo: setupXPackMain(server),
savedObjectTypes: server.savedObjects.types
@@ -111,10 +106,19 @@ export const xpackMain = (kibana) => {
xpackInfoRoute(server);
settingsRoute(server, this.kbnServer);
},
- deprecations: () => [
- movedToTelemetry('telemetry.config'),
- movedToTelemetry('telemetry.url'),
- movedToTelemetry('telemetry.enabled'),
- ],
+ deprecations: () => {
+ function movedToTelemetry(configPath) {
+ return (settings, log) => {
+ if (has(settings, configPath)) {
+ log(`Config key "xpack.xpack_main.${configPath}" is deprecated. Use "telemetry.${configPath}" instead.`);
+ }
+ };
+ }
+ return [
+ movedToTelemetry('telemetry.config'),
+ movedToTelemetry('telemetry.url'),
+ movedToTelemetry('telemetry.enabled'),
+ ];
+ },
});
};
diff --git a/x-pack/legacy/plugins/xpack_main/server/lib/__tests__/replace_injected_vars.js b/x-pack/legacy/plugins/xpack_main/server/lib/__tests__/replace_injected_vars.js
index c926170a2a4d..f094f588cf85 100644
--- a/x-pack/legacy/plugins/xpack_main/server/lib/__tests__/replace_injected_vars.js
+++ b/x-pack/legacy/plugins/xpack_main/server/lib/__tests__/replace_injected_vars.js
@@ -10,13 +10,8 @@ import expect from '@kbn/expect';
import { replaceInjectedVars } from '../replace_injected_vars';
import { KibanaRequest } from '../../../../../../../src/core/server';
-const buildRequest = (telemetryOptedIn = null, path = '/app/kibana') => {
+const buildRequest = (path = '/app/kibana') => {
const get = sinon.stub();
- if (telemetryOptedIn === null) {
- get.withArgs('telemetry', 'telemetry').rejects(new Error('not found exception'));
- } else {
- get.withArgs('telemetry', 'telemetry').resolves({ attributes: { enabled: telemetryOptedIn } });
- }
return {
path,
@@ -50,7 +45,6 @@ describe('replaceInjectedVars uiExport', () => {
const newVars = await replaceInjectedVars(originalInjectedVars, request, server);
expect(newVars).to.eql({
a: 1,
- telemetryOptedIn: null,
xpackInitialInfo: {
b: 1
},
@@ -73,7 +67,6 @@ describe('replaceInjectedVars uiExport', () => {
const newVars = await replaceInjectedVars(originalInjectedVars, request, server);
expect(newVars).to.eql({
a: 1,
- telemetryOptedIn: null,
xpackInitialInfo: {
b: 1
},
@@ -89,7 +82,6 @@ describe('replaceInjectedVars uiExport', () => {
const newVars = await replaceInjectedVars(originalInjectedVars, request, server);
expect(newVars).to.eql({
a: 1,
- telemetryOptedIn: null,
xpackInitialInfo: {
b: 1
},
@@ -98,14 +90,13 @@ describe('replaceInjectedVars uiExport', () => {
it('respects the telemetry opt-in document when opted-out', async () => {
const originalInjectedVars = { a: 1 };
- const request = buildRequest(false);
+ const request = buildRequest();
const server = mockServer();
server.plugins.xpack_main.info.license.isOneOf.returns(true);
const newVars = await replaceInjectedVars(originalInjectedVars, request, server);
expect(newVars).to.eql({
a: 1,
- telemetryOptedIn: false,
xpackInitialInfo: {
b: 1
},
@@ -114,14 +105,13 @@ describe('replaceInjectedVars uiExport', () => {
it('respects the telemetry opt-in document when opted-in', async () => {
const originalInjectedVars = { a: 1 };
- const request = buildRequest(true);
+ const request = buildRequest();
const server = mockServer();
server.plugins.xpack_main.info.license.isOneOf.returns(true);
const newVars = await replaceInjectedVars(originalInjectedVars, request, server);
expect(newVars).to.eql({
a: 1,
- telemetryOptedIn: true,
xpackInitialInfo: {
b: 1
},
@@ -137,7 +127,6 @@ describe('replaceInjectedVars uiExport', () => {
const newVars = await replaceInjectedVars(originalInjectedVars, request, server);
expect(newVars).to.eql({
a: 1,
- telemetryOptedIn: false,
xpackInitialInfo: {
b: 1
},
@@ -174,7 +163,6 @@ describe('replaceInjectedVars uiExport', () => {
const newVars = await replaceInjectedVars(originalInjectedVars, request, server);
expect(newVars).to.eql({
a: 1,
- telemetryOptedIn: null,
xpackInitialInfo: undefined,
uiCapabilities: {
navLinks: { foo: true },
diff --git a/x-pack/legacy/plugins/xpack_main/server/lib/replace_injected_vars.js b/x-pack/legacy/plugins/xpack_main/server/lib/replace_injected_vars.js
index 9def7da5e7e4..cd111240261c 100644
--- a/x-pack/legacy/plugins/xpack_main/server/lib/replace_injected_vars.js
+++ b/x-pack/legacy/plugins/xpack_main/server/lib/replace_injected_vars.js
@@ -5,14 +5,12 @@
*/
import { KibanaRequest } from '../../../../../../src/core/server';
-import { getTelemetryOptIn } from '../../../telemetry/server';
export async function replaceInjectedVars(originalInjectedVars, request, server) {
const xpackInfo = server.plugins.xpack_main.info;
const withXpackInfo = async () => ({
...originalInjectedVars,
- telemetryOptedIn: await getTelemetryOptIn(request),
xpackInitialInfo: xpackInfo.isAvailable() ? xpackInfo.toJSON() : undefined,
});
diff --git a/x-pack/legacy/plugins/telemetry/server/collectors/local/__tests__/get_xpack.js b/x-pack/legacy/plugins/xpack_main/server/telemetry_collection/__tests__/get_xpack.js
similarity index 100%
rename from x-pack/legacy/plugins/telemetry/server/collectors/local/__tests__/get_xpack.js
rename to x-pack/legacy/plugins/xpack_main/server/telemetry_collection/__tests__/get_xpack.js
diff --git a/x-pack/legacy/plugins/telemetry/server/collectors/local/constants.js b/x-pack/legacy/plugins/xpack_main/server/telemetry_collection/constants.ts
similarity index 100%
rename from x-pack/legacy/plugins/telemetry/server/collectors/local/constants.js
rename to x-pack/legacy/plugins/xpack_main/server/telemetry_collection/constants.ts
diff --git a/x-pack/legacy/plugins/xpack_main/server/telemetry_collection/get_stats_with_xpack.ts b/x-pack/legacy/plugins/xpack_main/server/telemetry_collection/get_stats_with_xpack.ts
new file mode 100644
index 000000000000..f19695ca0652
--- /dev/null
+++ b/x-pack/legacy/plugins/xpack_main/server/telemetry_collection/get_stats_with_xpack.ts
@@ -0,0 +1,42 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the Elastic License;
+ * you may not use this file except in compliance with the Elastic License.
+ */
+
+// @ts-ignore
+import { getXPack } from './get_xpack';
+import { getLocalStats } from '../../../../../../src/legacy/core_plugins/telemetry/server/telemetry_collection';
+
+/**
+ * Get the telemetry data.
+ *
+ * @param {Object} req The incoming request.
+ * @param {Object} config Kibana config.
+ * @param {String} start The start time of the request (likely 20m ago).
+ * @param {String} end The end time of the request.
+ * @param {Boolean} unencrypted Is the request payload going to be unencrypted.
+ * @return {Promise} An array of telemetry objects.
+ */
+export async function getStatsWithXpack(
+ req: any,
+ config: any,
+ start: string,
+ end: string,
+ unencrypted: boolean
+) {
+ const useInternalUser = !unencrypted;
+ const { server } = req;
+ const { callWithRequest, callWithInternalUser } = server.plugins.elasticsearch.getCluster('data');
+ const callCluster = useInternalUser
+ ? callWithInternalUser
+ : (...args: any[]) => callWithRequest(req, ...args);
+
+ const localStats = await getLocalStats(req, { useInternalUser });
+ const { license, xpack } = await getXPack(callCluster);
+
+ localStats.license = license;
+ localStats.stack_stats.xpack = xpack;
+
+ return [localStats];
+}
diff --git a/x-pack/legacy/plugins/telemetry/server/collectors/local/get_xpack.js b/x-pack/legacy/plugins/xpack_main/server/telemetry_collection/get_xpack.js
similarity index 99%
rename from x-pack/legacy/plugins/telemetry/server/collectors/local/get_xpack.js
rename to x-pack/legacy/plugins/xpack_main/server/telemetry_collection/get_xpack.js
index 3909741c8c55..07d635ef52e2 100644
--- a/x-pack/legacy/plugins/telemetry/server/collectors/local/get_xpack.js
+++ b/x-pack/legacy/plugins/xpack_main/server/telemetry_collection/get_xpack.js
@@ -83,4 +83,3 @@ export function getXPack(callCluster) {
})
.catch(() => { return {}; });
}
-
diff --git a/x-pack/legacy/plugins/oss_telemetry/server/lib/collectors/csp/index.ts b/x-pack/legacy/plugins/xpack_main/server/telemetry_collection/index.ts
similarity index 80%
rename from x-pack/legacy/plugins/oss_telemetry/server/lib/collectors/csp/index.ts
rename to x-pack/legacy/plugins/xpack_main/server/telemetry_collection/index.ts
index a7c1088f9961..553f8dc0c418 100644
--- a/x-pack/legacy/plugins/oss_telemetry/server/lib/collectors/csp/index.ts
+++ b/x-pack/legacy/plugins/xpack_main/server/telemetry_collection/index.ts
@@ -4,4 +4,4 @@
* you may not use this file except in compliance with the Elastic License.
*/
-export { registerCspCollector } from './csp_collector';
+export { getStatsWithXpack } from './get_stats_with_xpack';
diff --git a/x-pack/plugins/translations/translations/ja-JP.json b/x-pack/plugins/translations/translations/ja-JP.json
index cc48f87aa6a9..90613ba4378a 100644
--- a/x-pack/plugins/translations/translations/ja-JP.json
+++ b/x-pack/plugins/translations/translations/ja-JP.json
@@ -2469,8 +2469,6 @@
"kbn.visualize.wizard.step1Breadcrumb": "作成",
"kbn.visualize.wizard.step2Breadcrumb": "作成",
"kbn.visualizeTitle": "可視化",
- "kbn.home.telemetry.optInErrorToastText": "使用状況統計設定の設定中にエラーが発生しました。",
- "kbn.home.telemetry.optInErrorToastTitle": "エラー",
"kbn.advancedSettings.discover.searchOnPageLoadText": "ディスカバリの最初の読み込み時に検索を実行するかを制御します。この設定は、保存された検索の読み込み時には影響しません。",
"kbn.advancedSettings.discover.searchOnPageLoadTitle": "ページの読み込み時の検索",
"kbn.advancedSettings.visualization.heatmap.maxBucketsText": "1 つのデータソースが返せるバケットの最大数です。値が大きいとブラウザのレンダリング速度が下がる可能性があります。",
@@ -2485,17 +2483,6 @@
"kbn.home.addData.siem.addSiemEventsButtonLabel": "セキュリティイベントを追加",
"kbn.home.addData.siem.nameDescription": "即利用可能なビジュアライゼーションで、セキュリティイベントをまとめてインタラクティブな調査を可能にします。",
"kbn.home.addData.siem.nameTitle": "SIEM",
- "kbn.home.telemetry.callout.clusterStatisticsDescription": "これは収集される基本的なクラスター統計の例です。インデックス、チャート、ノードの数が含まれます。監視がオンになっているかどうかなどのハイレベルの使用統計も含まれます。",
- "kbn.home.telemetry.callout.clusterStatisticsTitle": "クラスター統計",
- "kbn.home.telemetry.callout.errorLoadingClusterStatisticsDescription": "クラスター統計の取得中に予期せぬエラーが発生しました。Elasticsearch、Kibana、またはネットワークのエラーが原因の可能性があります。Kibana を確認し、ページを再読み込みして再試行してください。",
- "kbn.home.telemetry.callout.errorLoadingClusterStatisticsTitle": "クラスター統計の読み込みエラー",
- "kbn.home.telemetry.callout.errorUnprivilegedUserDescription": "暗号化されていないクラスター統計を表示するアクセス権がありません。",
- "kbn.home.telemetry.callout.errorUnprivilegedUserTitle": "クラスター統計の表示エラー",
- "kbn.home.telemetry.optInMessage.detailsDescription": "ユーザーが処理したり保管したりするデータに関する情報は一切送信されません。この機能は定期的に基本的な機能利用に関する統計情報を送信します。{exampleLink} をご覧いただくか、{telemetryPrivacyStatementLink} をお読みください。この機能はいつでも無効にできます。",
- "kbn.home.telemetry.optInMessage.detailsExampleLinkText": "例",
- "kbn.home.telemetry.optInMessage.detailsTelemetryPrivacyStatementLinkText": "遠隔測定に関するプライバシーステートメント",
- "kbn.home.telemetry.optInMessage.readMoreLinkText": "さらに詳しく",
- "kbn.home.telemetry.optInMessageDescription": "基本的な機能利用に関する統計情報を提供して Elastic Stack の改善にご協力ください。このデータは Elastic 社外と共有されません。",
"kbn.home.telemtery.optInCardConfirmButtonLabel": "はい",
"kbn.home.telemtery.optInCardDeclineButtonLabel": "いいえ",
"kbn.home.telemtery.optInCardTitle": "Elastic Stack の改善にご協力ください",
@@ -10132,66 +10119,28 @@
"xpack.spaces.spaceSelector.noSpacesMatchSearchCriteriaDescription": "検索条件に一致するスペースがありません",
"xpack.spaces.spaceSelector.selectSpacesTitle": "スペースの選択",
"xpack.spaces.spacesTitle": "スペース",
- "xpack.spaces.management.copyToSpace.actionDescription": "この保存されたオブジェクトを 1 つまたは複数のスペースにコピーします。",
- "xpack.spaces.management.copyToSpace.actionTitle": "スペースにコピー",
- "xpack.spaces.management.copyToSpace.automaticallyOverwrite": "すべての保存されたオブジェクトを自動的に上書き",
- "xpack.spaces.management.copyToSpace.copyDetail.overwriteButton": "上書き",
- "xpack.spaces.management.copyToSpace.copyDetail.skipOverwriteButton": "スキップ",
- "xpack.spaces.management.copyToSpace.copyErrorTitle": "保存されたオブジェクトのコピー中にエラーが発生",
- "xpack.spaces.management.copyToSpace.copyResultsLabel": "コピー結果",
- "xpack.spaces.management.copyToSpace.copyStatus.conflictsMessage": "このスペースには同じ ID 「{id}」の保存されたオブジェクトが既に存在します。",
- "xpack.spaces.management.copyToSpace.copyStatus.conflictsOverwriteMessage": "「上書き」をクリックしてこのバージョンをコピーされたバージョンに置き換えます。",
- "xpack.spaces.management.copyToSpace.copyStatus.pendingOverwriteMessage": "保存されたオブジェクトは上書きされます。「スキップ」をクリックしてこの操作をキャンセルします。",
- "xpack.spaces.management.copyToSpace.copyStatus.successMessage": "保存されたオブジェクトがコピーされました。",
- "xpack.spaces.management.copyToSpace.copyStatus.unresolvableErrorMessage": "この保存されたオブジェクトのコピー中にエラーが発生しました。",
- "xpack.spaces.management.copyToSpace.copyStatusSummary.conflictsMessage": "{space} スペースに 1 つまたは複数の矛盾が検出されました。解決するにはこのセクションを拡張してください。",
- "xpack.spaces.management.copyToSpace.copyStatusSummary.failedMessage": "{space} スペースへのコピーに失敗しました。詳細はこのセクションを拡張してください。",
- "xpack.spaces.management.copyToSpace.copyStatusSummary.successMessage": "{space} スペースにコピーされました。",
- "xpack.spaces.management.copyToSpace.copyToSpacesButton": "{spaceCount} 個の{spaceCount, plural, one {スペース} other {スペース}}にコピー",
- "xpack.spaces.management.copyToSpace.disabledCopyToSpacesButton": "コピー",
- "xpack.spaces.management.copyToSpace.dontIncludeRelatedLabel": "関連性のある保存されたオブジェクトを含みません",
- "xpack.spaces.management.copyToSpace.dontOverwriteLabel": "保存されたオブジェクトを上書きしません",
- "xpack.spaces.management.copyToSpace.finishCopyToSpacesButton": "終了",
- "xpack.spaces.management.copyToSpace.finishedButtonLabel": "コピーが完了しました。",
- "xpack.spaces.management.copyToSpace.finishPendingOverwritesCopyToSpacesButton": "{overwriteCount} 件のオブジェクトを上書き",
- "xpack.spaces.management.copyToSpace.includeRelatedFormLabel": "関連性のある保存されたオブジェクトを含みます",
- "xpack.spaces.management.copyToSpace.includeRelatedLabel": "関連性のある保存されたオブジェクトを含みます",
- "xpack.spaces.management.copyToSpace.inProgressButtonLabel": "コピーが進行中です。お待ちください。",
- "xpack.spaces.management.copyToSpace.noSpacesBody": "コピーできるスペースがありません。",
- "xpack.spaces.management.copyToSpace.noSpacesTitle": "スペースがありません",
- "xpack.spaces.management.copyToSpace.overwriteLabel": "保存されたオブジェクトを自動的に上書きしています",
- "xpack.spaces.management.copyToSpace.resolveCopyErrorTitle": "保存されたオブジェクトの矛盾の解決中にエラーが発生",
- "xpack.spaces.management.copyToSpace.resolveCopySuccessTitle": "上書き成功",
- "xpack.spaces.management.copyToSpace.selectSpacesLabel": "コピー先のスペースを選択してください",
- "xpack.spaces.management.copyToSpace.spacesLoadErrorTitle": "利用可能なスペースを読み込み中にエラーが発生",
- "xpack.spaces.management.copyToSpaceFlyoutFooter.conflictCount": "スキップ",
- "xpack.spaces.management.copyToSpaceFlyoutFooter.errorCount": "エラー",
- "xpack.spaces.management.copyToSpaceFlyoutFooter.pendingCount": "保留中",
- "xpack.spaces.management.copyToSpaceFlyoutFooter.successCount": "コピー完了",
- "xpack.spaces.management.copyToSpaceFlyoutHeader": "保存されたオブジェクトのスペースへのコピー",
- "xpack.telemetry.callout.appliesSettingTitle": "この設定は {allOfKibanaText} に適用されます",
- "xpack.telemetry.callout.appliesSettingTitle.allOfKibanaText": "Kibana のすべて",
- "xpack.telemetry.callout.clusterStatisticsDescription": "これは収集される基本的なクラスター統計の例です。インデックス、チャート、ノードの数が含まれます。監視がオンになっているかどうかなどのハイレベルの使用統計も含まれます。",
- "xpack.telemetry.callout.clusterStatisticsTitle": "クラスター統計",
- "xpack.telemetry.callout.errorLoadingClusterStatisticsDescription": "クラスター統計の取得中に予期せぬエラーが発生しました。Elasticsearch、Kibana、またはネットワークのエラーが原因の可能性があります。Kibana を確認し、ページを再読み込みして再試行してください。",
- "xpack.telemetry.callout.errorLoadingClusterStatisticsTitle": "クラスター統計の読み込みエラー",
- "xpack.telemetry.callout.errorUnprivilegedUserDescription": "暗号化されていないクラスター統計を表示するアクセス権がありません。",
- "xpack.telemetry.callout.errorUnprivilegedUserTitle": "クラスター統計の表示エラー",
- "xpack.telemetry.readOurUsageDataPrivacyStatementLinkText": "使用データのプライバシーステートメントをお読みください",
- "xpack.telemetry.seeExampleOfWhatWeCollectLinkText": "収集されるデータの例を見る",
- "xpack.telemetry.telemetryConfigDescription": "基本的な機能利用に関する統計情報を提供して Elastic Stack の改善にご協力ください。このデータは Elastic 社外と共有されません。",
- "xpack.telemetry.telemetryConfigTitle": "遠隔測定オプトイン",
- "xpack.telemetry.telemetryErrorNotificationMessageDescription.tryAgainText": "Kibana と Elasticsearch が現在も実行中であることを確認し、再試行してください。",
- "xpack.telemetry.telemetryErrorNotificationMessageDescription.unableToSaveTelemetryPreferenceText": "遠隔測定設定を保存できません。",
- "xpack.telemetry.telemetryErrorNotificationMessageTitle": "遠隔測定エラー",
- "xpack.telemetry.usageDataTitle": "使用データ",
- "xpack.telemetry.welcomeBanner.noButtonLabel": "いいえ",
- "xpack.telemetry.welcomeBanner.telemetryConfigDescription.readMoreLinkText": "続きを読む",
- "xpack.telemetry.welcomeBanner.telemetryConfigDetailsDescription": "ユーザーが処理したり保管したりするデータに関する情報は一切送信されません。この機能は定期的に基本的な機能利用に関する統計情報を送信します。{exampleLink} をご覧いただくか、{telemetryPrivacyStatementLink} をお読みください。この機能はいつでも無効にできます。",
- "xpack.telemetry.welcomeBanner.telemetryConfigDetailsDescription.exampleLinkText": "例",
- "xpack.telemetry.welcomeBanner.telemetryConfigDetailsDescription.telemetryPrivacyStatementLinkText": "遠隔測定に関するプライバシーステートメント",
- "xpack.telemetry.welcomeBanner.yesButtonLabel": "はい",
- "xpack.telemetry.welcomeBanner.title": "Elastic Stack の改善にご協力ください!",
+ "telemetry.callout.appliesSettingTitle": "この設定は {allOfKibanaText} に適用されます",
+ "telemetry.callout.appliesSettingTitle.allOfKibanaText": "Kibana のすべて",
+ "telemetry.callout.clusterStatisticsDescription": "これは収集される基本的なクラスター統計の例です。インデックス、チャート、ノードの数が含まれます。監視がオンになっているかどうかなどのハイレベルの使用統計も含まれます。",
+ "telemetry.callout.clusterStatisticsTitle": "クラスター統計",
+ "telemetry.callout.errorLoadingClusterStatisticsDescription": "クラスター統計の取得中に予期せぬエラーが発生しました。Elasticsearch、Kibana、またはネットワークのエラーが原因の可能性があります。Kibana を確認し、ページを再読み込みして再試行してください。",
+ "telemetry.callout.errorLoadingClusterStatisticsTitle": "クラスター統計の読み込みエラー",
+ "telemetry.callout.errorUnprivilegedUserDescription": "暗号化されていないクラスター統計を表示するアクセス権がありません。",
+ "telemetry.callout.errorUnprivilegedUserTitle": "クラスター統計の表示エラー",
+ "telemetry.readOurUsageDataPrivacyStatementLinkText": "使用データのプライバシーステートメントをお読みください",
+ "telemetry.seeExampleOfWhatWeCollectLinkText": "収集されるデータの例を見る",
+ "telemetry.telemetryConfigDescription": "基本的な機能利用に関する統計情報を提供して Elastic Stack の改善にご協力ください。このデータは Elastic 社外と共有されません。",
+ "telemetry.telemetryConfigTitle": "遠隔測定オプトイン",
+ "telemetry.telemetryErrorNotificationMessageDescription.tryAgainText": "Kibana と Elasticsearch が現在も実行中であることを確認し、再試行してください。",
+ "telemetry.telemetryErrorNotificationMessageDescription.unableToSaveTelemetryPreferenceText": "遠隔測定設定を保存できません。",
+ "telemetry.telemetryErrorNotificationMessageTitle": "遠隔測定エラー",
+ "telemetry.usageDataTitle": "使用データ",
+ "telemetry.welcomeBanner.noButtonLabel": "いいえ",
+ "telemetry.welcomeBanner.telemetryConfigDescription.readMoreLinkText": "続きを読む",
+ "telemetry.welcomeBanner.telemetryConfigDetailsDescription": "ユーザーが処理したり保管したりするデータに関する情報は一切送信されません。この機能は定期的に基本的な機能利用に関する統計情報を送信します。{exampleLink} をご覧いただくか、{telemetryPrivacyStatementLink} をお読みください。この機能はいつでも無効にできます。",
+ "telemetry.welcomeBanner.telemetryConfigDetailsDescription.exampleLinkText": "例",
+ "telemetry.welcomeBanner.telemetryConfigDetailsDescription.telemetryPrivacyStatementLinkText": "遠隔測定に関するプライバシーステートメント",
+ "telemetry.welcomeBanner.yesButtonLabel": "はい",
"xpack.upgradeAssistant.appTitle": "{version} アップグレードアシスタント",
"xpack.upgradeAssistant.checkupTab.backUpCallout.calloutBody.calloutDetail": "{snapshotRestoreDocsButton} でデータをバックアップします。",
"xpack.upgradeAssistant.checkupTab.backUpCallout.calloutBody.snapshotRestoreDocsButtonLabel": "API のスナップショットと復元",
diff --git a/x-pack/plugins/translations/translations/zh-CN.json b/x-pack/plugins/translations/translations/zh-CN.json
index 7cdb1d73622e..22baff00f8cb 100644
--- a/x-pack/plugins/translations/translations/zh-CN.json
+++ b/x-pack/plugins/translations/translations/zh-CN.json
@@ -2470,8 +2470,6 @@
"kbn.visualize.wizard.step1Breadcrumb": "创建",
"kbn.visualize.wizard.step2Breadcrumb": "创建",
"kbn.visualizeTitle": "可视化",
- "kbn.home.telemetry.optInErrorToastText": "尝试设置使用统计信息首选项时发生错误。",
- "kbn.home.telemetry.optInErrorToastTitle": "错误",
"kbn.advancedSettings.discover.searchOnPageLoadText": "控制在 Discover 首次加载时是否执行搜索。加载已保存搜索时,此设置无效。",
"kbn.advancedSettings.discover.searchOnPageLoadTitle": "在页面加载时搜索",
"kbn.advancedSettings.visualization.heatmap.maxBucketsText": "单个数据源可以返回的最大存储桶数目。较高的数目可能对浏览器呈现性能有负面影响",
@@ -2486,17 +2484,6 @@
"kbn.home.addData.siem.addSiemEventsButtonLabel": "添加安全事件",
"kbn.home.addData.siem.nameDescription": "集中安全事件,以通过即用型可视化实现交互式调查。",
"kbn.home.addData.siem.nameTitle": "SIEM",
- "kbn.home.telemetry.callout.clusterStatisticsDescription": "这是我们将收集的基本集群统计信息的示例。其包括索引、分片和节点的数目。还包括高级使用情况统计信息,例如监测是否打开。",
- "kbn.home.telemetry.callout.clusterStatisticsTitle": "集群统计信息",
- "kbn.home.telemetry.callout.errorLoadingClusterStatisticsDescription": "尝试提取集群统计信息时发生意外错误。发生此问题的原因可能是 Elasticsearch 出故障、Kibana 出故障,或者有网络错误。检查 Kibana,然后重新加载页面并重试。",
- "kbn.home.telemetry.callout.errorLoadingClusterStatisticsTitle": "加载集群统计信息时出错",
- "kbn.home.telemetry.callout.errorUnprivilegedUserDescription": "您无权查看未加密的集群统计信息。",
- "kbn.home.telemetry.callout.errorUnprivilegedUserTitle": "显示集群统计信息时出错",
- "kbn.home.telemetry.optInMessage.detailsDescription": "不会发送有关您处理或存储的数据的信息。此功能将定期发送基本功能使用情况统计信息。请参阅{exampleLink}或阅读我们的{telemetryPrivacyStatementLink}。您可以随时禁用此功能。",
- "kbn.home.telemetry.optInMessage.detailsExampleLinkText": "示例",
- "kbn.home.telemetry.optInMessage.detailsTelemetryPrivacyStatementLinkText": "遥测隐私声明",
- "kbn.home.telemetry.optInMessage.readMoreLinkText": "阅读更多内容",
- "kbn.home.telemetry.optInMessageDescription": "通过提供基本功能的使用情况统计信息,来帮助我们改进 Elastic Stack。我们不会在 Elastic 之外共享此数据。",
"kbn.home.telemtery.optInCardConfirmButtonLabel": "是",
"kbn.home.telemtery.optInCardDeclineButtonLabel": "否",
"kbn.home.telemtery.optInCardTitle": "帮助我们改进 Elastic Stack",
@@ -10288,66 +10275,28 @@
"xpack.spaces.spaceSelector.noSpacesMatchSearchCriteriaDescription": "没有匹配搜索条件的空间",
"xpack.spaces.spaceSelector.selectSpacesTitle": "选择您的空间",
"xpack.spaces.spacesTitle": "工作区",
- "xpack.spaces.management.copyToSpace.actionDescription": "将此已保存对象复制到一个或多个工作区",
- "xpack.spaces.management.copyToSpace.actionTitle": "复制到工作区",
- "xpack.spaces.management.copyToSpace.automaticallyOverwrite": "自动覆盖所有已保存对象",
- "xpack.spaces.management.copyToSpace.copyDetail.overwriteButton": "覆盖",
- "xpack.spaces.management.copyToSpace.copyDetail.skipOverwriteButton": "跳过",
- "xpack.spaces.management.copyToSpace.copyErrorTitle": "复制已保存对象时出错",
- "xpack.spaces.management.copyToSpace.copyResultsLabel": "复制结果",
- "xpack.spaces.management.copyToSpace.copyStatus.conflictsMessage": "具有匹配 ID ({id}) 的已保存对象在此工作区中已存在。",
- "xpack.spaces.management.copyToSpace.copyStatus.conflictsOverwriteMessage": "单击“覆盖”可将此版本替换为复制的版本。",
- "xpack.spaces.management.copyToSpace.copyStatus.pendingOverwriteMessage": "已保存对象将被覆盖。单击“跳过”可取消此操作。",
- "xpack.spaces.management.copyToSpace.copyStatus.successMessage": "已保存对象成功复制。",
- "xpack.spaces.management.copyToSpace.copyStatus.unresolvableErrorMessage": "复制此已保存对象时出错。",
- "xpack.spaces.management.copyToSpace.copyStatusSummary.conflictsMessage": "在 {space} 工作区中检测到一个或多个冲突。展开此部分以进行解决。",
- "xpack.spaces.management.copyToSpace.copyStatusSummary.failedMessage": "复制到 {space} 工作区失败。展开此部分以获取详情。",
- "xpack.spaces.management.copyToSpace.copyStatusSummary.successMessage": "已成功复制到 {space} 工作区。",
- "xpack.spaces.management.copyToSpace.copyToSpacesButton": "复制到 {spaceCount} 个 {spaceCount, plural, one {工作区} other {工作区}}",
- "xpack.spaces.management.copyToSpace.disabledCopyToSpacesButton": "复制",
- "xpack.spaces.management.copyToSpace.dontIncludeRelatedLabel": "不包括相关已保存对象",
- "xpack.spaces.management.copyToSpace.dontOverwriteLabel": "未覆盖已保存对象",
- "xpack.spaces.management.copyToSpace.finishCopyToSpacesButton": "完成",
- "xpack.spaces.management.copyToSpace.finishedButtonLabel": "复制已完成。",
- "xpack.spaces.management.copyToSpace.finishPendingOverwritesCopyToSpacesButton": "覆盖 {overwriteCount} 个对象",
- "xpack.spaces.management.copyToSpace.includeRelatedFormLabel": "包括相关已保存对象",
- "xpack.spaces.management.copyToSpace.includeRelatedLabel": "包括相关已保存对象",
- "xpack.spaces.management.copyToSpace.inProgressButtonLabel": "复制正在进行中。请稍候。",
- "xpack.spaces.management.copyToSpace.noSpacesBody": "没有要复制到的合格工作区。",
- "xpack.spaces.management.copyToSpace.noSpacesTitle": "没有可用的工作区",
- "xpack.spaces.management.copyToSpace.overwriteLabel": "正在自动覆盖已保存对象",
- "xpack.spaces.management.copyToSpace.resolveCopyErrorTitle": "解决已保存对象冲突时出错",
- "xpack.spaces.management.copyToSpace.resolveCopySuccessTitle": "覆盖成功",
- "xpack.spaces.management.copyToSpace.selectSpacesLabel": "选择要复制到的工作区",
- "xpack.spaces.management.copyToSpace.spacesLoadErrorTitle": "加载可用工作区时出错",
- "xpack.spaces.management.copyToSpaceFlyoutFooter.conflictCount": "已跳过",
- "xpack.spaces.management.copyToSpaceFlyoutFooter.errorCount": "错误",
- "xpack.spaces.management.copyToSpaceFlyoutFooter.pendingCount": "待处理",
- "xpack.spaces.management.copyToSpaceFlyoutFooter.successCount": "已复制",
- "xpack.spaces.management.copyToSpaceFlyoutHeader": "将已保存对象复制到工作区",
- "xpack.telemetry.callout.appliesSettingTitle": "此设置适用于{allOfKibanaText}",
- "xpack.telemetry.callout.appliesSettingTitle.allOfKibanaText": "所有 Kibana。",
- "xpack.telemetry.callout.clusterStatisticsDescription": "这是我们将收集的基本集群统计信息的示例。其包括索引、分片和节点的数目。还包括高级使用情况统计信息,例如监测是否打开。",
- "xpack.telemetry.callout.clusterStatisticsTitle": "集群统计信息",
- "xpack.telemetry.callout.errorLoadingClusterStatisticsDescription": "尝试提取集群统计信息时发生意外错误。发生此问题的原因可能是 Elasticsearch 出故障、Kibana 出故障,或者有网络错误。检查 Kibana,然后重新加载页面并重试。",
- "xpack.telemetry.callout.errorLoadingClusterStatisticsTitle": "加载集群统计信息时出错",
- "xpack.telemetry.callout.errorUnprivilegedUserDescription": "您无权查看未加密的集群统计信息。",
- "xpack.telemetry.callout.errorUnprivilegedUserTitle": "显示集群统计信息时出错",
- "xpack.telemetry.readOurUsageDataPrivacyStatementLinkText": "阅读我们的使用情况数据隐私声明",
- "xpack.telemetry.seeExampleOfWhatWeCollectLinkText": "查看我们收集的内容示例",
- "xpack.telemetry.telemetryConfigDescription": "通过提供基本功能的使用情况统计信息,来帮助我们改进 Elastic Stack。我们不会在 Elastic 之外共享此数据。",
- "xpack.telemetry.telemetryConfigTitle": "遥测选择加入",
- "xpack.telemetry.telemetryErrorNotificationMessageDescription.tryAgainText": "确认 Kibana 和 Elasticsearch 仍在运行,然后重试。",
- "xpack.telemetry.telemetryErrorNotificationMessageDescription.unableToSaveTelemetryPreferenceText": "无法保存遥测首选项。",
- "xpack.telemetry.telemetryErrorNotificationMessageTitle": "遥测错误",
- "xpack.telemetry.usageDataTitle": "使用情况数据",
- "xpack.telemetry.welcomeBanner.noButtonLabel": "否",
- "xpack.telemetry.welcomeBanner.telemetryConfigDescription.readMoreLinkText": "阅读更多内容",
- "xpack.telemetry.welcomeBanner.telemetryConfigDetailsDescription": "不会发送有关您处理或存储的数据的信息。此功能将定期发送基本功能使用情况统计信息。请参阅{exampleLink}或阅读我们的{telemetryPrivacyStatementLink}。您可以随时禁用此功能。",
- "xpack.telemetry.welcomeBanner.telemetryConfigDetailsDescription.exampleLinkText": "示例",
- "xpack.telemetry.welcomeBanner.telemetryConfigDetailsDescription.telemetryPrivacyStatementLinkText": "遥测隐私声明",
- "xpack.telemetry.welcomeBanner.yesButtonLabel": "是",
- "xpack.telemetry.welcomeBanner.title": "帮助我们改进 Elastic Stack!",
+ "telemetry.callout.appliesSettingTitle": "此设置适用于{allOfKibanaText}",
+ "telemetry.callout.appliesSettingTitle.allOfKibanaText": "所有 Kibana。",
+ "telemetry.callout.clusterStatisticsDescription": "这是我们将收集的基本集群统计信息的示例。其包括索引、分片和节点的数目。还包括高级使用情况统计信息,例如监测是否打开。",
+ "telemetry.callout.clusterStatisticsTitle": "集群统计信息",
+ "telemetry.callout.errorLoadingClusterStatisticsDescription": "尝试提取集群统计信息时发生意外错误。发生此问题的原因可能是 Elasticsearch 出故障、Kibana 出故障,或者有网络错误。检查 Kibana,然后重新加载页面并重试。",
+ "telemetry.callout.errorLoadingClusterStatisticsTitle": "加载集群统计信息时出错",
+ "telemetry.callout.errorUnprivilegedUserDescription": "您无权查看未加密的集群统计信息。",
+ "telemetry.callout.errorUnprivilegedUserTitle": "显示集群统计信息时出错",
+ "telemetry.readOurUsageDataPrivacyStatementLinkText": "阅读我们的使用情况数据隐私声明",
+ "telemetry.seeExampleOfWhatWeCollectLinkText": "查看我们收集的内容示例",
+ "telemetry.telemetryConfigDescription": "通过提供基本功能的使用情况统计信息,来帮助我们改进 Elastic Stack。我们不会在 Elastic 之外共享此数据。",
+ "telemetry.telemetryConfigTitle": "遥测选择加入",
+ "telemetry.telemetryErrorNotificationMessageDescription.tryAgainText": "确认 Kibana 和 Elasticsearch 仍在运行,然后重试。",
+ "telemetry.telemetryErrorNotificationMessageDescription.unableToSaveTelemetryPreferenceText": "无法保存遥测首选项。",
+ "telemetry.telemetryErrorNotificationMessageTitle": "遥测错误",
+ "telemetry.usageDataTitle": "使用情况数据",
+ "telemetry.welcomeBanner.noButtonLabel": "否",
+ "telemetry.welcomeBanner.telemetryConfigDescription.readMoreLinkText": "阅读更多内容",
+ "telemetry.welcomeBanner.telemetryConfigDetailsDescription": "不会发送有关您处理或存储的数据的信息。此功能将定期发送基本功能使用情况统计信息。请参阅{exampleLink}或阅读我们的{telemetryPrivacyStatementLink}。您可以随时禁用此功能。",
+ "telemetry.welcomeBanner.telemetryConfigDetailsDescription.exampleLinkText": "示例",
+ "telemetry.welcomeBanner.telemetryConfigDetailsDescription.telemetryPrivacyStatementLinkText": "遥测隐私声明",
+ "telemetry.welcomeBanner.yesButtonLabel": "是",
"xpack.upgradeAssistant.appTitle": "{version} 升级助手",
"xpack.upgradeAssistant.checkupTab.backUpCallout.calloutBody.calloutDetail": "使用 {snapshotRestoreDocsButton} 备份您的数据。",
"xpack.upgradeAssistant.checkupTab.backUpCallout.calloutBody.snapshotRestoreDocsButtonLabel": "快照和还原 API",
diff --git a/x-pack/test/functional/config.js b/x-pack/test/functional/config.js
index 0f30f854003d..ab88fbb4e30f 100644
--- a/x-pack/test/functional/config.js
+++ b/x-pack/test/functional/config.js
@@ -79,12 +79,12 @@ export default async function ({ readConfigFile }) {
'--server.uuid=5b2de169-2785-441b-ae8c-186a1936b17d',
'--xpack.maps.showMapsInspectorAdapter=true',
'--xpack.maps.preserveDrawingBuffer=true',
- '--xpack.telemetry.banner=false',
'--xpack.reporting.queue.pollInterval=3000', // make it explicitly the default
'--xpack.reporting.csv.maxSizeBytes=2850', // small-ish limit for cutting off a 1999 byte report
'--stats.maximumWaitTimeForAllCollectorsInS=0',
'--xpack.security.encryptionKey="wuGNaIhoMpk5sO4UBxgr3NyW1sFcLgIf"', // server restarts should not invalidate active sessions
'--xpack.encrypted_saved_objects.encryptionKey="DkdXazszSCYexXqz4YktBGHCRkV6hyNK"',
+ '--telemetry.banner=false',
'--timelion.ui.enabled=true',
],
},