Skip to content

Commit

Permalink
Bug fixes for observability count distribution and application analyt…
Browse files Browse the repository at this point in the history
…ics (opensearch-project#1187) (opensearch-project#1188)

* remove unused files



* missing snapshots



* remove unused files



* fix for count distribution disappear on page refresh



* fix query composing issue in app analytics



* add one fix for count distribution and update snapshots



---------



(cherry picked from commit 0b238a0)

Signed-off-by: Eric Wei <menwe@amazon.com>
Signed-off-by: Eric <menwe@amazon.com>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
1 parent d19d8e0 commit 6db98ee
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 4 deletions.
5 changes: 4 additions & 1 deletion public/components/common/query_utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,10 @@ export const buildPatternsQuery = (
return finalQuery;
};

export const buildQuery = (baseQuery: string, currQuery: string) => baseQuery + '| ' + currQuery;
export const buildQuery = (baseQuery: string, currQuery: string) => {
if (!currQuery) return baseQuery;
return `${baseQuery} | ${currQuery}`;
};

export const buildRawQuery = (query: IQuery, appBaseQuery: string) => {
if (appBaseQuery && !query.rawQuery.includes(appBaseQuery))
Expand Down
17 changes: 15 additions & 2 deletions public/components/event_analytics/explorer/explorer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,12 @@ export const Explorer = ({
...TIME_INTERVAL_OPTIONS,
]);
selectedIntervalRef.current = { text: 'Auto', value: 'auto_' + minInterval };
dispatch(
updateCountDistribution({
tabId,
data: { selectedInterval: selectedIntervalRef.current.value.replace(/^auto_/, '') },
})
);
};

useEffect(() => {
Expand Down Expand Up @@ -495,13 +501,18 @@ export const Explorer = ({
selectedIntervalRef.current = timeIntervalOptions[intervalOptionsIndex];
getPatterns(intrv, getErrorHandler('Error fetching patterns'));
}}
stateInterval={selectedIntervalRef.current?.value}
stateInterval={
countDistribution.selectedInterval || selectedIntervalRef.current?.value
}
startTime={appLogEvents ? startTime : dateRange[0]}
endTime={appLogEvents ? endTime : dateRange[1]}
/>
<EuiSpacer size="s" />
<CountDistribution
countDistribution={countDistribution}
selectedInterval={selectedIntervalRef.current?.value}
selectedInterval={
countDistribution.selectedInterval || selectedIntervalRef.current?.value
}
startTime={appLogEvents ? startTime : dateRange[0]}
endTime={appLogEvents ? endTime : dateRange[1]}
/>
Expand Down Expand Up @@ -783,6 +794,8 @@ export const Explorer = ({
subType,
selectedCustomPanelOptions,
explorerSearchMeta,
selectedIntervalRef.current,
countDistribution,
]);

const liveTailLoop = async (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
*/

import React from 'react';
import { EuiPanel } from '@elastic/eui';
import { BarOrientation, LONG_CHART_COLOR } from '../../../../../../common/constants/shared';
import { Plt } from '../../../../visualizations/plotly/plot';
import { fillTimeDataWithEmpty } from '../../../utils/utils';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export const countDistributionSlice = createSlice({
reducers: {
render: (state, { payload }) => {
state[payload.tabId] = {
...state[payload.tabId],
...payload.data,
};
},
Expand Down

0 comments on commit 6db98ee

Please sign in to comment.