From 46abb5111f5db69a392b11abf322d50acb4c3c9a Mon Sep 17 00:00:00 2001 From: Yngrid Coello Date: Fri, 25 Jul 2025 12:47:48 +0200 Subject: [PATCH 1/3] Handling errors on docCount in streams list --- .../insufficient_privileges.tsx | 58 +++----------- .../stream_list_view/documents_column.tsx | 27 +++++-- .../tooltip_popover_icon.tsx | 76 +++++++++++++++++++ 3 files changed, 107 insertions(+), 54 deletions(-) create mode 100644 x-pack/platform/plugins/shared/streams_app/public/components/tooltip_popover_icon/tooltip_popover_icon.tsx diff --git a/x-pack/platform/plugins/shared/streams_app/public/components/insufficient_privileges/insufficient_privileges.tsx b/x-pack/platform/plugins/shared/streams_app/public/components/insufficient_privileges/insufficient_privileges.tsx index b01817c7e05c1..b203a4484733c 100644 --- a/x-pack/platform/plugins/shared/streams_app/public/components/insufficient_privileges/insufficient_privileges.tsx +++ b/x-pack/platform/plugins/shared/streams_app/public/components/insufficient_privileges/insufficient_privileges.tsx @@ -6,17 +6,9 @@ */ import React from 'react'; -import useToggle from 'react-use/lib/useToggle'; import { i18n } from '@kbn/i18n'; -import { - EuiButtonIcon, - EuiButtonIconProps, - EuiPopover, - EuiToolTip, - EuiIcon, - EuiFlexGroup, - EuiButtonIconPropsForButton, -} from '@elastic/eui'; +import { EuiButtonIconProps, EuiButtonIconPropsForButton } from '@elastic/eui'; +import { TooltipOrPopoverIcon } from '../tooltip_popover_icon/tooltip_popover_icon'; const insufficientPrivilegesText = i18n.translate('xpack.streams.insufficientPrivilegesMessage', { defaultMessage: "You don't have sufficient privileges to access this information.", @@ -37,46 +29,20 @@ export const PrivilegesWarningIconWrapper = ({ popoverCss?: EuiButtonIconProps['css']; children: React.ReactNode; }) => { - const [isPopoverOpen, togglePopover] = useToggle(false); - - const handleButtonClick = togglePopover; - if (hasPrivileges) { return <>{children}; } - return mode === 'popover' ? ( - - } - isOpen={isPopoverOpen} - closePopover={togglePopover} + return ( + - {insufficientPrivilegesText} - - ) : ( - - - - {children} - - + {children} + ); }; diff --git a/x-pack/platform/plugins/shared/streams_app/public/components/stream_list_view/documents_column.tsx b/x-pack/platform/plugins/shared/streams_app/public/components/stream_list_view/documents_column.tsx index 286eac753d0f8..5841f281814ab 100644 --- a/x-pack/platform/plugins/shared/streams_app/public/components/stream_list_view/documents_column.tsx +++ b/x-pack/platform/plugins/shared/streams_app/public/components/stream_list_view/documents_column.tsx @@ -30,6 +30,8 @@ import { useStreamsAppFetch } from '../../hooks/use_streams_app_fetch'; import { useKibana } from '../../hooks/use_kibana'; import { esqlResultToTimeseries } from '../../util/esql_result_to_timeseries'; import { useTimefilter } from '../../hooks/use_timefilter'; +import { TooltipOrPopoverIcon } from '../tooltip_popover_icon/tooltip_popover_icon'; +import { getFormattedError } from '../../util/errors'; export function DocumentsColumn({ indexPattern, @@ -105,6 +107,7 @@ export function DocumentsColumn({ [streamsRepositoryClient, indexPattern, minInterval], { withTimeRange: true, + disableToastOnError: true, } ); @@ -130,6 +133,20 @@ export function DocumentsColumn({ const xFormatter = niceTimeFormatter([timeState.start, timeState.end]); + const noDocCountData = histogramQueryFetch.error ? '' : ; + + const noHistogramData = histogramQueryFetch.error ? ( + + ) : ( + + ); + return ( - {hasData ? ( - - ) : ( - i18n.translate('xpack.streams.documentsColumn.noDataLabel', { - defaultMessage: 'N/A', - }) - )} + {hasData ? : noDocCountData} ) : ( - + noHistogramData )} diff --git a/x-pack/platform/plugins/shared/streams_app/public/components/tooltip_popover_icon/tooltip_popover_icon.tsx b/x-pack/platform/plugins/shared/streams_app/public/components/tooltip_popover_icon/tooltip_popover_icon.tsx new file mode 100644 index 0000000000000..f794f4510b43c --- /dev/null +++ b/x-pack/platform/plugins/shared/streams_app/public/components/tooltip_popover_icon/tooltip_popover_icon.tsx @@ -0,0 +1,76 @@ +/* + * 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 useToggle from 'react-use/lib/useToggle'; +import { + EuiButtonIcon, + EuiButtonIconProps, + EuiPopover, + EuiToolTip, + EuiIcon, + EuiFlexGroup, + EuiButtonIconPropsForButton, + IconType, +} from '@elastic/eui'; + +export const TooltipOrPopoverIcon = ({ + title, + mode = 'popover', + icon, + iconColor = 'warning', + popoverCss, + dataTestSubj, + children, +}: { + title: string; + mode?: 'tooltip' | 'popover'; + icon: IconType; + iconColor?: EuiButtonIconPropsForButton['color']; + popoverCss?: EuiButtonIconProps['css']; + dataTestSubj: string; + children?: React.ReactNode; +}) => { + const [isPopoverOpen, togglePopover] = useToggle(false); + + const handleButtonClick = togglePopover; + + return mode === 'popover' ? ( + + } + isOpen={isPopoverOpen} + closePopover={togglePopover} + > + {title} + + ) : ( + + + + {children} + + + ); +}; From 793f789bf81bccdafc22bb20378644457d8af08b Mon Sep 17 00:00:00 2001 From: Yngrid Coello Date: Mon, 4 Aug 2025 11:42:11 +0200 Subject: [PATCH 2/3] disabling failure sotre by default and enabling for some --- .../lib/logs/custom_logsdb_index_templates.ts | 22 ++++++++++++++++++- .../dataset_quality/dataset_quality_table.ts | 14 ++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/src/platform/packages/shared/kbn-apm-synthtrace/src/lib/logs/custom_logsdb_index_templates.ts b/src/platform/packages/shared/kbn-apm-synthtrace/src/lib/logs/custom_logsdb_index_templates.ts index df864078658df..c52cf7052b3c4 100644 --- a/src/platform/packages/shared/kbn-apm-synthtrace/src/lib/logs/custom_logsdb_index_templates.ts +++ b/src/platform/packages/shared/kbn-apm-synthtrace/src/lib/logs/custom_logsdb_index_templates.ts @@ -13,6 +13,7 @@ export enum IndexTemplateName { LogsDb = 'logsdb', Synht2 = 'synth.2', SomeFailureStore = 'synth.fs', + NoFailureStore = 'synth.no-fs', } export const indexTemplates: { @@ -49,7 +50,7 @@ export const indexTemplates: { default_pipeline: 'synth.2@pipeline', }, }, - priority: 500, + priority: 501, index_patterns: ['logs-synth.2-*'], composed_of: ['logs@mappings', 'logs@settings', 'ecs@mappings', 'synth.2@custom'], allow_auto_create: true, @@ -57,6 +58,25 @@ export const indexTemplates: { hidden: false, }, }, + [IndexTemplateName.NoFailureStore]: { + name: IndexTemplateName.NoFailureStore, + _meta: { + managed: false, + description: 'custom index template created by synthtrace tool', + }, + template: { + settings: { + default_pipeline: 'logs@default-pipeline', + }, + }, + priority: 500, + index_patterns: ['logs-*'], + composed_of: ['logs@mappings', 'logs@settings', 'ecs@mappings', 'synth.no-fs@custom'], + allow_auto_create: true, + data_stream: { + hidden: false, + }, + }, [IndexTemplateName.SomeFailureStore]: { name: IndexTemplateName.SomeFailureStore, _meta: { diff --git a/x-pack/solutions/observability/test/functional/apps/dataset_quality/dataset_quality_table.ts b/x-pack/solutions/observability/test/functional/apps/dataset_quality/dataset_quality_table.ts index aadfaff8582d2..ddaf533b87a02 100644 --- a/x-pack/solutions/observability/test/functional/apps/dataset_quality/dataset_quality_table.ts +++ b/x-pack/solutions/observability/test/functional/apps/dataset_quality/dataset_quality_table.ts @@ -50,6 +50,18 @@ export default function ({ getService, getPageObjects }: DatasetQualityFtrProvid // Install Integration and ingest logs for it await PageObjects.observabilityLogsExplorer.installPackage(pkg); + // Disable failure store for logs-* + await synthtrace.createComponentTemplate({ + name: 'synth.no-fs@custom', + dataStreamOptions: { + failure_store: { + enabled: false, + }, + }, + }); + await synthtrace.createIndexTemplate(IndexTemplateName.NoFailureStore); + + // Enable failure store only for logs-synth.2-* await synthtrace.createCustomPipeline(processors, 'synth.2@pipeline'); await synthtrace.createComponentTemplate({ name: 'synth.2@custom', @@ -97,6 +109,8 @@ export default function ({ getService, getPageObjects }: DatasetQualityFtrProvid after(async () => { await synthtrace.clean(); await PageObjects.observabilityLogsExplorer.uninstallPackage(pkg); + await synthtrace.deleteIndexTemplate(IndexTemplateName.NoFailureStore); + await synthtrace.deleteComponentTemplate('synth.no-fs@custom'); await synthtrace.deleteIndexTemplate(IndexTemplateName.Synht2); await synthtrace.deleteComponentTemplate('synth.2@custom'); await synthtrace.deleteCustomPipeline('synth.2@pipeline'); From f3daa9626dc56c91e916eb84bc6a0dafce53ac7d Mon Sep 17 00:00:00 2001 From: Yngrid Coello Date: Mon, 4 Aug 2025 12:11:30 +0200 Subject: [PATCH 3/3] Adding fs disabling to index template --- .../src/lib/logs/custom_logsdb_index_templates.ts | 7 ++++++- .../apps/dataset_quality/dataset_quality_table.ts | 9 --------- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/src/platform/packages/shared/kbn-apm-synthtrace/src/lib/logs/custom_logsdb_index_templates.ts b/src/platform/packages/shared/kbn-apm-synthtrace/src/lib/logs/custom_logsdb_index_templates.ts index c52cf7052b3c4..a2894305abedc 100644 --- a/src/platform/packages/shared/kbn-apm-synthtrace/src/lib/logs/custom_logsdb_index_templates.ts +++ b/src/platform/packages/shared/kbn-apm-synthtrace/src/lib/logs/custom_logsdb_index_templates.ts @@ -67,11 +67,16 @@ export const indexTemplates: { template: { settings: { default_pipeline: 'logs@default-pipeline', + data_stream_options: { + failure_store: { + enabled: false, + }, + }, }, }, priority: 500, index_patterns: ['logs-*'], - composed_of: ['logs@mappings', 'logs@settings', 'ecs@mappings', 'synth.no-fs@custom'], + composed_of: ['logs@mappings', 'logs@settings', 'ecs@mappings'], allow_auto_create: true, data_stream: { hidden: false, diff --git a/x-pack/solutions/observability/test/functional/apps/dataset_quality/dataset_quality_table.ts b/x-pack/solutions/observability/test/functional/apps/dataset_quality/dataset_quality_table.ts index ddaf533b87a02..32e96c9766048 100644 --- a/x-pack/solutions/observability/test/functional/apps/dataset_quality/dataset_quality_table.ts +++ b/x-pack/solutions/observability/test/functional/apps/dataset_quality/dataset_quality_table.ts @@ -51,14 +51,6 @@ export default function ({ getService, getPageObjects }: DatasetQualityFtrProvid await PageObjects.observabilityLogsExplorer.installPackage(pkg); // Disable failure store for logs-* - await synthtrace.createComponentTemplate({ - name: 'synth.no-fs@custom', - dataStreamOptions: { - failure_store: { - enabled: false, - }, - }, - }); await synthtrace.createIndexTemplate(IndexTemplateName.NoFailureStore); // Enable failure store only for logs-synth.2-* @@ -110,7 +102,6 @@ export default function ({ getService, getPageObjects }: DatasetQualityFtrProvid await synthtrace.clean(); await PageObjects.observabilityLogsExplorer.uninstallPackage(pkg); await synthtrace.deleteIndexTemplate(IndexTemplateName.NoFailureStore); - await synthtrace.deleteComponentTemplate('synth.no-fs@custom'); await synthtrace.deleteIndexTemplate(IndexTemplateName.Synht2); await synthtrace.deleteComponentTemplate('synth.2@custom'); await synthtrace.deleteCustomPipeline('synth.2@pipeline');