From 7386cd6752fa11ebcb6054d75096b5bfcc90a9ec Mon Sep 17 00:00:00 2001 From: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Date: Thu, 14 Oct 2021 14:47:30 -0400 Subject: [PATCH] [Stack Monitoring] Remove deprecation warning for Internal Monitoring (#114856) (#115048) * [Stack Monitoring] Remove deprecation warning for Internal Monitoring * Fix i18n Co-authored-by: Zacqary Adam Xeper --- .../public/lib/internal_monitoring_toasts.tsx | 116 ------------------ .../monitoring/public/services/clusters.js | 39 ------ .../translations/translations/ja-JP.json | 6 - .../translations/translations/zh-CN.json | 6 - 4 files changed, 167 deletions(-) delete mode 100644 x-pack/plugins/monitoring/public/lib/internal_monitoring_toasts.tsx diff --git a/x-pack/plugins/monitoring/public/lib/internal_monitoring_toasts.tsx b/x-pack/plugins/monitoring/public/lib/internal_monitoring_toasts.tsx deleted file mode 100644 index b970ba5998ddf..0000000000000 --- a/x-pack/plugins/monitoring/public/lib/internal_monitoring_toasts.tsx +++ /dev/null @@ -1,116 +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 - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import React from 'react'; -import { i18n } from '@kbn/i18n'; -import { FormattedMessage } from '@kbn/i18n/react'; -import { EuiSpacer, EuiLink } from '@elastic/eui'; -import { Legacy } from '../legacy_shims'; -import { toMountPoint } from '../../../../../src/plugins/kibana_react/public'; -import { isInSetupMode, toggleSetupMode } from './setup_mode'; - -export interface MonitoringIndicesTypes { - legacyIndices: number; - metricbeatIndices: number; -} - -const enterSetupModeLabel = () => - i18n.translate('xpack.monitoring.internalMonitoringToast.enterSetupMode', { - defaultMessage: 'Enter setup mode', - }); - -const learnMoreLabel = () => - i18n.translate('xpack.monitoring.internalMonitoringToast.learnMoreAction', { - defaultMessage: 'Learn more', - }); - -const showIfLegacyOnlyIndices = () => { - const blogUrl = Legacy.shims.docLinks.links.monitoring.metricbeatBlog; - const toast = Legacy.shims.toastNotifications.addWarning({ - title: toMountPoint( - - ), - text: toMountPoint( -
-

- {i18n.translate('xpack.monitoring.internalMonitoringToast.description', { - defaultMessage: `It appears you are using "Legacy Collection" for Stack Monitoring. - This method of monitoring will no longer be supported in the next major release (8.0.0). - Please follow the steps in setup mode to start monitoring with Metricbeat.`, - })} -

- { - Legacy.shims.toastNotifications.remove(toast); - toggleSetupMode(true); - }} - > - {enterSetupModeLabel()} - - - - - {learnMoreLabel()} - -
- ), - }); -}; - -const showIfLegacyAndMetricbeatIndices = () => { - const blogUrl = Legacy.shims.docLinks.links.monitoring.metricbeatBlog; - const toast = Legacy.shims.toastNotifications.addWarning({ - title: toMountPoint( - - ), - text: toMountPoint( -
-

- {i18n.translate('xpack.monitoring.internalAndMetricbeatMonitoringToast.description', { - defaultMessage: `It appears you are using both Metricbeat and "Legacy Collection" for Stack Monitoring. - In 8.0.0, you must use Metricbeat to collect monitoring data. - Please follow the steps in setup mode to migrate the rest of the monitoring to Metricbeat.`, - })} -

- { - Legacy.shims.toastNotifications.remove(toast); - toggleSetupMode(true); - }} - > - {enterSetupModeLabel()} - - - - - {learnMoreLabel()} - -
- ), - }); -}; - -export const showInternalMonitoringToast = ({ - legacyIndices, - metricbeatIndices, -}: MonitoringIndicesTypes) => { - if (isInSetupMode()) { - return; - } - - if (legacyIndices && !metricbeatIndices) { - showIfLegacyOnlyIndices(); - } else if (legacyIndices && metricbeatIndices) { - showIfLegacyAndMetricbeatIndices(); - } -}; diff --git a/x-pack/plugins/monitoring/public/services/clusters.js b/x-pack/plugins/monitoring/public/services/clusters.js index 937a69cbbc32d..b19d0ea56765f 100644 --- a/x-pack/plugins/monitoring/public/services/clusters.js +++ b/x-pack/plugins/monitoring/public/services/clusters.js @@ -8,7 +8,6 @@ import { ajaxErrorHandlersProvider } from '../lib/ajax_error_handler'; import { Legacy } from '../legacy_shims'; import { STANDALONE_CLUSTER_CLUSTER_UUID } from '../../common/constants'; -import { showInternalMonitoringToast } from '../lib/internal_monitoring_toasts'; function formatClusters(clusters) { return clusters.map(formatCluster); @@ -21,8 +20,6 @@ function formatCluster(cluster) { return cluster; } -let once = false; - export function monitoringClustersProvider($injector) { return async (clusterUuid, ccs, codePaths) => { const { min, max } = Legacy.shims.timefilter.getBounds(); @@ -57,42 +54,6 @@ export function monitoringClustersProvider($injector) { } } - async function ensureMetricbeatEnabled() { - if (Legacy.shims.isCloud) { - return; - } - const globalState = $injector.get('globalState'); - try { - const response = await $http.post( - '../api/monitoring/v1/elasticsearch_settings/check/internal_monitoring', - { - ccs: globalState.ccs, - } - ); - const { data } = response; - showInternalMonitoringToast({ - legacyIndices: data.legacy_indices, - metricbeatIndices: data.mb_indices, - }); - } catch (err) { - const Private = $injector.get('Private'); - const ajaxErrorHandlers = Private(ajaxErrorHandlersProvider); - return ajaxErrorHandlers(err); - } - } - - if (!once) { - once = true; - const clusters = await getClusters(); - if (clusters.length) { - try { - await ensureMetricbeatEnabled(); - } catch (_err) { - // Intentionally swallow the error as this will retry the next page load - } - } - return clusters; - } return await getClusters(); }; } diff --git a/x-pack/plugins/translations/translations/ja-JP.json b/x-pack/plugins/translations/translations/ja-JP.json index a2ce88f4e4c11..28687dcb4ee5d 100644 --- a/x-pack/plugins/translations/translations/ja-JP.json +++ b/x-pack/plugins/translations/translations/ja-JP.json @@ -18029,12 +18029,6 @@ "xpack.monitoring.healthCheck.unableToDisableWatches.action": "詳細情報", "xpack.monitoring.healthCheck.unableToDisableWatches.text": "レガシークラスターアラートを削除できませんでした。Kibanaサーバーログで詳細を確認するか、しばらくたってから再試行してください。", "xpack.monitoring.healthCheck.unableToDisableWatches.title": "レガシークラスターアラートはまだ有効です", - "xpack.monitoring.internalAndMetricbeatMonitoringToast.description": "スタック監視で、Metricbeatと「レガシー収集」の両方を使用している可能性があります。\n 8.0.0では、Metricbeatを使用して、監視データを収集する必要があります。\n セットアップモードの手順に従い、残りの監視をMetricbeatに移行してください。", - "xpack.monitoring.internalAndMetricbeatMonitoringToast.title": "一部のレガシー監視が検出されました", - "xpack.monitoring.internalMonitoringToast.description": "スタック監視で、「レガシー収集」の両方を使用している可能性があります。\n この監視方法は、次のメジャーリリース(8.0.0)ではサポートされていません。\n セットアップモードの手順に従い、Metricbeatで監視を開始してください。", - "xpack.monitoring.internalMonitoringToast.enterSetupMode": "設定モードにする", - "xpack.monitoring.internalMonitoringToast.learnMoreAction": "詳細", - "xpack.monitoring.internalMonitoringToast.title": "内部監視が検出されました", "xpack.monitoring.kibana.clusterStatus.connectionsLabel": "接続", "xpack.monitoring.kibana.clusterStatus.instancesLabel": "インスタンス", "xpack.monitoring.kibana.clusterStatus.maxResponseTimeLabel": "最高応答時間", diff --git a/x-pack/plugins/translations/translations/zh-CN.json b/x-pack/plugins/translations/translations/zh-CN.json index fcd9dcf107edc..d0d01049df177 100644 --- a/x-pack/plugins/translations/translations/zh-CN.json +++ b/x-pack/plugins/translations/translations/zh-CN.json @@ -18304,12 +18304,6 @@ "xpack.monitoring.healthCheck.unableToDisableWatches.action": "了解详情。", "xpack.monitoring.healthCheck.unableToDisableWatches.text": "我们移除旧版集群告警。请查看 Kibana 服务器日志以获取更多信息,或稍后重试。", "xpack.monitoring.healthCheck.unableToDisableWatches.title": "旧版集群告警仍有效", - "xpack.monitoring.internalAndMetricbeatMonitoringToast.description": "似乎您正在同时使用 Metricbeat 和“Legacy Collection”进行堆栈监测。\n 在 8.0.0 中,必须使用 Metricbeat 收集监测数据。\n 请在设置模式下按照相关步骤将监测的其余部分迁移到 Metricbeat。", - "xpack.monitoring.internalAndMetricbeatMonitoringToast.title": "检测到部分旧版监测", - "xpack.monitoring.internalMonitoringToast.description": "似乎您正在使用“Legacy Collection”进行堆栈监测。\n 下一主要版本 (8.0.0) 将不再支持这种监测方法。\n 请在设置模式下按照相关步骤使用 Metricbeat 开始监测。", - "xpack.monitoring.internalMonitoringToast.enterSetupMode": "进入设置模式", - "xpack.monitoring.internalMonitoringToast.learnMoreAction": "了解详情", - "xpack.monitoring.internalMonitoringToast.title": "检测到内部监测", "xpack.monitoring.kibana.clusterStatus.connectionsLabel": "连接", "xpack.monitoring.kibana.clusterStatus.instancesLabel": "实例", "xpack.monitoring.kibana.clusterStatus.maxResponseTimeLabel": "最大响应时间",