From c3d8fb42415cc7e688957a7612733095ad50e71a Mon Sep 17 00:00:00 2001 From: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Date: Mon, 23 Sep 2024 20:00:28 +1000 Subject: [PATCH] [8.x] [ML] AIOps: Move Log Rate Analysis results callout to help popover. (#192243) (#193675) # Backport This will backport the following commits from `main` to `8.x`: - [[ML] AIOps: Move Log Rate Analysis results callout to help popover. (#192243)](https://github.com/elastic/kibana/pull/192243) ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) Co-authored-by: Walter Rafelsberger --- .../progress_controls/progress_controls.tsx | 5 + .../log_rate_analysis_info_popover.tsx | 128 ++++++++++++++++++ .../log_rate_analysis_results.tsx | 7 +- .../log_rate_analysis_type_callout.tsx | 84 ------------ .../translations/translations/fr-FR.json | 8 -- .../translations/translations/ja-JP.json | 8 -- .../translations/translations/zh-CN.json | 8 -- .../services/aiops/log_rate_analysis_page.ts | 16 +-- 8 files changed, 142 insertions(+), 122 deletions(-) create mode 100644 x-pack/plugins/aiops/public/components/log_rate_analysis/log_rate_analysis_info_popover.tsx delete mode 100644 x-pack/plugins/aiops/public/components/log_rate_analysis/log_rate_analysis_type_callout.tsx diff --git a/x-pack/packages/ml/aiops_components/src/progress_controls/progress_controls.tsx b/x-pack/packages/ml/aiops_components/src/progress_controls/progress_controls.tsx index 4f08a259bbac2..098f7038f82c8 100644 --- a/x-pack/packages/ml/aiops_components/src/progress_controls/progress_controls.tsx +++ b/x-pack/packages/ml/aiops_components/src/progress_controls/progress_controls.tsx @@ -39,6 +39,7 @@ interface ProgressControlProps { isRunning: boolean; shouldRerunAnalysis: boolean; runAnalysisDisabled?: boolean; + analysisInfo?: React.ReactNode; } /** @@ -61,6 +62,7 @@ export const ProgressControls: FC> = (pr isRunning, shouldRerunAnalysis, runAnalysisDisabled = false, + analysisInfo = null, } = props; const progressOutput = Math.round(progress * 100); @@ -137,6 +139,9 @@ export const ProgressControls: FC> = (pr })} + + {analysisInfo} + ) : null} ; + label: string; +}> = ({ onClick, label }) => { + return ( + + {label} + + ); +}; + +export const LogRateAnalysisInfoPopover: FC = () => { + const euiTheme = useEuiTheme(); + + const showInfoPopover = useAppSelector( + (s) => s.logRateAnalysisResults.significantItems.length > 0 + ); + const zeroDocsFallback = useAppSelector((s) => s.logRateAnalysisResults.zeroDocsFallback); + const analysisType = useAppSelector((s) => s.logRateAnalysisResults.currentAnalysisType); + const fieldSelectionMessage = useAppSelector( + (s) => s.logRateAnalysisFieldCandidates.fieldSelectionMessage + ); + + const [isPopoverOpen, setIsPopoverOpen] = useState(false); + + const infoTitlePrefix = i18n.translate('xpack.aiops.analysis.analysisTypeInfoTitlePrefix', { + defaultMessage: 'Analysis type: ', + }); + let infoTitle: string; + let infoContent: string; + + if (!showInfoPopover) { + return null; + } + + if (!zeroDocsFallback && analysisType === LOG_RATE_ANALYSIS_TYPE.SPIKE) { + infoTitle = i18n.translate('xpack.aiops.analysis.analysisTypeSpikeInfoTitle', { + defaultMessage: 'Log rate spike', + }); + infoContent = i18n.translate('xpack.aiops.analysis.analysisTypeSpikeInfoContent', { + defaultMessage: + 'The median log rate in the selected deviation time range is higher than the baseline. Therefore, the analysis results table shows statistically significant items within the deviation time range that are contributors to the spike. The "doc count" column refers to the amount of documents in the deviation time range.', + }); + } else if (!zeroDocsFallback && analysisType === LOG_RATE_ANALYSIS_TYPE.DIP) { + infoTitle = i18n.translate('xpack.aiops.analysis.analysisTypeDipInfoTitle', { + defaultMessage: 'Log rate dip', + }); + infoContent = i18n.translate('xpack.aiops.analysis.analysisTypeDipInfoContent', { + defaultMessage: + 'The median log rate in the selected deviation time range is lower than the baseline. Therefore, the analysis results table shows statistically significant items within the baseline time range that are less in number or missing within the deviation time range. The "doc count" column refers to the amount of documents in the baseline time range.', + }); + } else if (zeroDocsFallback && analysisType === LOG_RATE_ANALYSIS_TYPE.SPIKE) { + infoTitle = i18n.translate('xpack.aiops.analysis.analysisTypeSpikeFallbackInfoTitle', { + defaultMessage: 'Top items for deviation time range', + }); + infoContent = i18n.translate('xpack.aiops.analysis.analysisTypeSpikeInfoContentFallback', { + defaultMessage: + 'The baseline time range does not contain any documents. Therefore the results show top log message categories and field values for the deviation time range.', + }); + } else if (zeroDocsFallback && analysisType === LOG_RATE_ANALYSIS_TYPE.DIP) { + infoTitle = i18n.translate('xpack.aiops.analysis.analysisTypeDipFallbackInfoTitle', { + defaultMessage: 'Top items for baseline time range', + }); + infoContent = i18n.translate('xpack.aiops.analysis.analysisTypeDipInfoContentFallback', { + defaultMessage: + 'The deviation time range does not contain any documents. Therefore the results show top log message categories and field values for the baseline time range.', + }); + } else { + return null; + } + + return ( + + } + closePopover={setIsPopoverOpen.bind(null, false)} + isOpen={isPopoverOpen} + ownFocus + panelPaddingSize="m" + > + {infoTitle && ( + + {infoTitlePrefix} + {infoTitle} + + )} + + +

+ {infoContent} + {fieldSelectionMessage && ` ${fieldSelectionMessage}`} +

+
+
+ ); +}; diff --git a/x-pack/plugins/aiops/public/components/log_rate_analysis/log_rate_analysis_results.tsx b/x-pack/plugins/aiops/public/components/log_rate_analysis/log_rate_analysis_results.tsx index 8c2cf12ca376c..70b37ac2ab5d0 100644 --- a/x-pack/plugins/aiops/public/components/log_rate_analysis/log_rate_analysis_results.tsx +++ b/x-pack/plugins/aiops/public/components/log_rate_analysis/log_rate_analysis_results.tsx @@ -62,7 +62,7 @@ import { import { ItemFilterPopover as FieldFilterPopover } from './item_filter_popover'; import { ItemFilterPopover as ColumnFilterPopover } from './item_filter_popover'; -import { LogRateAnalysisTypeCallOut } from './log_rate_analysis_type_callout'; +import { LogRateAnalysisInfoPopover } from './log_rate_analysis_info_popover'; import type { ColumnNames } from '../log_rate_analysis_results_table'; const groupResultsMessage = i18n.translate( @@ -425,6 +425,7 @@ export const LogRateAnalysisResults: FC = ({ onCancel={cancelHandler} onReset={onReset} shouldRerunAnalysis={shouldRerunAnalysis} + analysisInfo={} > @@ -480,8 +481,6 @@ export const LogRateAnalysisResults: FC = ({ - - {errors.length > 0 ? ( <> @@ -530,7 +529,7 @@ export const LogRateAnalysisResults: FC = ({ {groupResults ? groupResultsHelpMessage : undefined} )} - + {!isRunning && !showLogRateAnalysisResultsTable && ( { - const showCallout = useAppSelector((s) => s.logRateAnalysisResults.significantItems.length > 0); - const zeroDocsFallback = useAppSelector((s) => s.logRateAnalysisResults.zeroDocsFallback); - const analysisType = useAppSelector((s) => s.logRateAnalysisResults.currentAnalysisType); - const fieldSelectionMessage = useAppSelector( - (s) => s.logRateAnalysisFieldCandidates.fieldSelectionMessage - ); - - let callOutTitle: string; - let callOutText: string; - - if (!showCallout) { - return null; - } - - if (!zeroDocsFallback && analysisType === LOG_RATE_ANALYSIS_TYPE.SPIKE) { - callOutTitle = i18n.translate('xpack.aiops.analysis.analysisTypeSpikeCallOutTitle', { - defaultMessage: 'Analysis type: Log rate spike', - }); - callOutText = i18n.translate('xpack.aiops.analysis.analysisTypeSpikeCallOutContent', { - defaultMessage: - 'The median log rate in the selected deviation time range is higher than the baseline. Therefore, the analysis results table shows statistically significant items within the deviation time range that are contributors to the spike. The "doc count" column refers to the amount of documents in the deviation time range.', - }); - } else if (!zeroDocsFallback && analysisType === LOG_RATE_ANALYSIS_TYPE.DIP) { - callOutTitle = i18n.translate('xpack.aiops.analysis.analysisTypeDipCallOutTitle', { - defaultMessage: 'Analysis type: Log rate dip', - }); - callOutText = i18n.translate('xpack.aiops.analysis.analysisTypeDipCallOutContent', { - defaultMessage: - 'The median log rate in the selected deviation time range is lower than the baseline. Therefore, the analysis results table shows statistically significant items within the baseline time range that are less in number or missing within the deviation time range. The "doc count" column refers to the amount of documents in the baseline time range.', - }); - } else if (zeroDocsFallback && analysisType === LOG_RATE_ANALYSIS_TYPE.SPIKE) { - callOutTitle = i18n.translate('xpack.aiops.analysis.analysisTypeSpikeFallbackCallOutTitle', { - defaultMessage: 'Analysis type: Top items for deviation time range', - }); - callOutText = i18n.translate('xpack.aiops.analysis.analysisTypeSpikeCallOutContentFallback', { - defaultMessage: - 'The baseline time range does not contain any documents. Therefore the results show top log message categories and field values for the deviation time range.', - }); - } else if (zeroDocsFallback && analysisType === LOG_RATE_ANALYSIS_TYPE.DIP) { - callOutTitle = i18n.translate('xpack.aiops.analysis.analysisTypeDipFallbackCallOutTitle', { - defaultMessage: 'Analysis type: Top items for baseline time range', - }); - callOutText = i18n.translate('xpack.aiops.analysis.analysisTypeDipCallOutContentFallback', { - defaultMessage: - 'The deviation time range does not contain any documents. Therefore the results show top log message categories and field values for the baseline time range.', - }); - } else { - return null; - } - - return ( - <> - - {callOutTitle}} - color="primary" - iconType="pin" - size="s" - > - - {callOutText} - {fieldSelectionMessage && ` ${fieldSelectionMessage}`} - - - - - ); -}; diff --git a/x-pack/plugins/translations/translations/fr-FR.json b/x-pack/plugins/translations/translations/fr-FR.json index 3903fba64200c..bfc76731e56bc 100644 --- a/x-pack/plugins/translations/translations/fr-FR.json +++ b/x-pack/plugins/translations/translations/fr-FR.json @@ -9393,14 +9393,6 @@ "xpack.actions.subActionsFramework.urlValidationError": "Erreur lors de la validation de l'URL : {message}", "xpack.actions.urlAllowedHostsConfigurationError": "Le {field} cible \"{value}\" n'est pas ajouté à la configuration Kibana xpack.actions.allowedHosts", "xpack.aiops.actions.openChangePointInMlAppName": "Ouvrir dans AIOps Labs", - "xpack.aiops.analysis.analysisTypeDipCallOutContent": "Le taux de log médian pour la plage temporelle d'écart-type sélectionnée est inférieur à la référence de base. Le tableau des résultats de l'analyse présente donc des éléments statistiquement significatifs inclus dans la plage temporelle de base qui sont moins nombreux ou manquant dans la plage temporelle d'écart-type. La colonne \"doc count\" (décompte de documents) renvoie à la quantité de documents dans la plage temporelle de base.", - "xpack.aiops.analysis.analysisTypeDipCallOutContentFallback": "La plage temporelle de déviation ne contient aucun document. Les résultats montrent donc les catégories de message des meilleurs logs et les valeurs des champs pour la période de référence.", - "xpack.aiops.analysis.analysisTypeDipCallOutTitle": "Type d'analyse : Baisse du taux de log", - "xpack.aiops.analysis.analysisTypeDipFallbackCallOutTitle": "Type d'analyse : Meilleurs éléments pour la plage temporelle de référence de base", - "xpack.aiops.analysis.analysisTypeSpikeCallOutContent": "Le taux de log médian pour la plage temporelle d'écart-type sélectionnée est inférieur à la référence de base. Le tableau des résultats de l'analyse présente donc des éléments statistiquement significatifs inclus dans la plage temporelle d'écart-type, qui contribuent au pic. La colonne \"doc count\" (décompte de documents) renvoie à la quantité de documents dans la plage temporelle d'écart-type.", - "xpack.aiops.analysis.analysisTypeSpikeCallOutContentFallback": "La plage temporelle de référence de base ne contient aucun document. Les résultats montrent donc les catégories de message des meilleurs logs et les valeurs des champs pour la plage temporelle de déviation.", - "xpack.aiops.analysis.analysisTypeSpikeCallOutTitle": "Type d'analyse : Pic du taux de log", - "xpack.aiops.analysis.analysisTypeSpikeFallbackCallOutTitle": "Type d'analyse : Meilleurs éléments pour la plage temporelle de déviation", "xpack.aiops.analysis.columnSelectorAriaLabel": "Filtrer les colonnes", "xpack.aiops.analysis.columnSelectorNotEnoughColumnsSelected": "Au moins une colonne doit être sélectionnée.", "xpack.aiops.analysis.errorCallOutTitle": "Génération {errorCount, plural, one {de l'erreur suivante} other {des erreurs suivantes}} au cours de l'analyse.", diff --git a/x-pack/plugins/translations/translations/ja-JP.json b/x-pack/plugins/translations/translations/ja-JP.json index 3931961c383ba..93263035ad8ce 100644 --- a/x-pack/plugins/translations/translations/ja-JP.json +++ b/x-pack/plugins/translations/translations/ja-JP.json @@ -9387,14 +9387,6 @@ "xpack.actions.subActionsFramework.urlValidationError": "URLの検証エラー:{message}", "xpack.actions.urlAllowedHostsConfigurationError": "ターゲット{field}「{value}」はKibana構成xpack.actions.allowedHostsに追加されていません", "xpack.aiops.actions.openChangePointInMlAppName": "AIOps Labsで開く", - "xpack.aiops.analysis.analysisTypeDipCallOutContent": "選択された偏差時間範囲におけるログレートの中央値は、ベースラインよりも低くなります。そのため、分析結果テーブルでは、ベースライン時間範囲内では統計的に有意な項目が、偏差値時間範囲内では数が少ないか欠落していることが示されています。\"ドキュメントカウント\"列は、基準時間範囲のドキュメント量です。", - "xpack.aiops.analysis.analysisTypeDipCallOutContentFallback": "偏差時間範囲にはドキュメントが含まれていません。したがって、この結果は、ベースライン時間範囲の上位のログメッセージカテゴリーとフィールド値を示しています。", - "xpack.aiops.analysis.analysisTypeDipCallOutTitle": "分析タイプ:ログレートディップ", - "xpack.aiops.analysis.analysisTypeDipFallbackCallOutTitle": "分析タイプ:ベースライン時間範囲の上位のアイテム", - "xpack.aiops.analysis.analysisTypeSpikeCallOutContent": "選択された偏差時間範囲におけるログレートの中央値は、ベースラインよりも高くなります。したがって、分析結果テーブルでは、スパイクの要因となる偏差時間範囲内の統計的に有意な項目が示されています。\"ドキュメントカウント\"列は、偏差時間範囲のドキュメント量です。", - "xpack.aiops.analysis.analysisTypeSpikeCallOutContentFallback": "ベースライン時間範囲にはドキュメントが含まれていません。したがって、結果は、偏差時間範囲の上位のログメッセージカテゴリーとフィールド値を示しています。", - "xpack.aiops.analysis.analysisTypeSpikeCallOutTitle": "分析タイプ:ログレートスパイク", - "xpack.aiops.analysis.analysisTypeSpikeFallbackCallOutTitle": "分析タイプ:偏差時間範囲の上位のアイテム", "xpack.aiops.analysis.columnSelectorAriaLabel": "列のフィルタリング", "xpack.aiops.analysis.columnSelectorNotEnoughColumnsSelected": "1つ以上の列を選択する必要があります。", "xpack.aiops.analysis.errorCallOutTitle": "次の{errorCount, plural, other {エラー}}が分析の実行中に発生しました。", diff --git a/x-pack/plugins/translations/translations/zh-CN.json b/x-pack/plugins/translations/translations/zh-CN.json index fcb7a9821fdba..0b4b7785451ce 100644 --- a/x-pack/plugins/translations/translations/zh-CN.json +++ b/x-pack/plugins/translations/translations/zh-CN.json @@ -9401,14 +9401,6 @@ "xpack.actions.subActionsFramework.urlValidationError": "验证 URL 时出错:{message}", "xpack.actions.urlAllowedHostsConfigurationError": "目标 {field} 的“{value}”未添加到 Kibana 配置 xpack.actions.allowedHosts", "xpack.aiops.actions.openChangePointInMlAppName": "在 Aiops 实验室中打开", - "xpack.aiops.analysis.analysisTypeDipCallOutContent": "选定偏差时间范围中的中位日志速率低于基线。因此,分析结果表将显示基线时间范围内数量较少或偏差时间范围内缺失的具有统计意义的项目。“文档计数”列统计基线时间范围内的文档数量。", - "xpack.aiops.analysis.analysisTypeDipCallOutContentFallback": "偏差时间范围不包含任何文档。因此,结果将显示基线时间范围的主要日志消息类别和字段值。", - "xpack.aiops.analysis.analysisTypeDipCallOutTitle": "分析类型:日志速率谷值", - "xpack.aiops.analysis.analysisTypeDipFallbackCallOutTitle": "分析类型:基线时间范围的主要项目", - "xpack.aiops.analysis.analysisTypeSpikeCallOutContent": "选定偏差时间范围中的中位日志速率高于基线。因此,分析结果表将显示偏差时间范围内有助于达到峰值的具有统计意义的项目。“文档计数”列统计偏差时间范围内的文档数量。", - "xpack.aiops.analysis.analysisTypeSpikeCallOutContentFallback": "基线时间范围不包含任何文档。因此,结果将显示偏差时间范围的主要日志消息类别和字段值。", - "xpack.aiops.analysis.analysisTypeSpikeCallOutTitle": "分析类型:日志速率峰值", - "xpack.aiops.analysis.analysisTypeSpikeFallbackCallOutTitle": "分析类型:偏差时间范围的主要项目", "xpack.aiops.analysis.columnSelectorAriaLabel": "筛选列", "xpack.aiops.analysis.columnSelectorNotEnoughColumnsSelected": "必须至少选择一列。", "xpack.aiops.analysis.errorCallOutTitle": "运行分析时发生以下{errorCount, plural, other {错误}}。", diff --git a/x-pack/test/functional/services/aiops/log_rate_analysis_page.ts b/x-pack/test/functional/services/aiops/log_rate_analysis_page.ts index 8ef2f02d4eb03..66c4e64f05efe 100644 --- a/x-pack/test/functional/services/aiops/log_rate_analysis_page.ts +++ b/x-pack/test/functional/services/aiops/log_rate_analysis_page.ts @@ -295,21 +295,17 @@ export function LogRateAnalysisPageProvider({ getService, getPageObject }: FtrPr return; } - await testSubjects.existOrFail('aiopsAnalysisTypeCalloutTitle'); - const currentAnalysisTypeCalloutTitle = await testSubjects.getVisibleText( - 'aiopsAnalysisTypeCalloutTitle' + await testSubjects.existOrFail('aiopsLogRateAnalysisInfoPopoverButton'); + const currentAnalysisTypePopoverButtonLabel = await testSubjects.getVisibleText( + 'aiopsLogRateAnalysisInfoPopoverButton' ); if (zeroDocsFallback && analysisType === 'spike') { - expect(currentAnalysisTypeCalloutTitle).to.be( - 'Analysis type: Top items for deviation time range' - ); + expect(currentAnalysisTypePopoverButtonLabel).to.be('Top items for deviation time range'); } else if (zeroDocsFallback && analysisType === 'dip') { - expect(currentAnalysisTypeCalloutTitle).to.be( - 'Analysis type: Top items for baseline time range' - ); + expect(currentAnalysisTypePopoverButtonLabel).to.be('Top items for baseline time range'); } else { - expect(currentAnalysisTypeCalloutTitle).to.be(`Analysis type: Log rate ${analysisType}`); + expect(currentAnalysisTypePopoverButtonLabel).to.be(`Log rate ${analysisType}`); } }); },