From 625433f4e4e278d5311138bb983f959561ea840e Mon Sep 17 00:00:00 2001 From: Joshua Li Date: Fri, 4 Nov 2022 09:45:56 -0700 Subject: [PATCH] Use in-memory count for total hits in patterns ratio (#1254) Signed-off-by: Joshua Li --- .../public/components/event_analytics/explorer/explorer.tsx | 5 ----- .../explorer/log_patterns/patterns_table.tsx | 6 ++---- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/dashboards-observability/public/components/event_analytics/explorer/explorer.tsx b/dashboards-observability/public/components/event_analytics/explorer/explorer.tsx index f56f98b65..f94dc4a21 100644 --- a/dashboards-observability/public/components/event_analytics/explorer/explorer.tsx +++ b/dashboards-observability/public/components/event_analytics/explorer/explorer.tsx @@ -879,11 +879,6 @@ export const Explorer = ({ tabId={tabId} query={query} isPatternLoading={isPatternLoading} - totalHits={reduce( - countDistribution.data['count()'], - (sum, n) => sum + n, - 0 - )} /> diff --git a/dashboards-observability/public/components/event_analytics/explorer/log_patterns/patterns_table.tsx b/dashboards-observability/public/components/event_analytics/explorer/log_patterns/patterns_table.tsx index aac53448b..bd02b7d52 100644 --- a/dashboards-observability/public/components/event_analytics/explorer/log_patterns/patterns_table.tsx +++ b/dashboards-observability/public/components/event_analytics/explorer/log_patterns/patterns_table.tsx @@ -25,13 +25,11 @@ interface PatternsTableProps { tabId: string; query: any; isPatternLoading: boolean; - totalHits?: number; } export function PatternsTable(props: PatternsTableProps) { - const { tableData, tabId, onPatternSelection, query } = props; - const patternsData = useSelector(selectPatterns)[tabId]; - const totalHits = props.totalHits || tableData.reduce((p, v) => p + v.count, 0); + const { tableData, onPatternSelection, query } = props; + const totalHits = tableData.reduce((p, v) => p + v.count, 0); const tableColumns = [ {