Skip to content

Commit

Permalink
[8.x] [ML] AIOps Log rate analysis: switch to Rerun analysis copy if …
Browse files Browse the repository at this point in the history
…search bar search changes (#198179) (#198841)

# Backport

This will backport the following commits from `main` to `8.x`:
- [[ML] AIOps Log rate analysis: switch to Rerun analysis copy if search
bar search changes
(#198179)](#198179)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Melissa
Alvarez","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-11-04T18:54:28Z","message":"[ML]
AIOps Log rate analysis: switch to Rerun analysis copy if search bar
search changes (#198179)\n\n## Summary\r\n\r\nRelated meta issue:
https://github.com/elastic/kibana/issues/196660\r\n\r\nCorresponds to
item: \r\n`UI: should switch to Rerun analysis copy if we change up the
search in\r\nthe search bar, otherwise hover data in the main chart
doesn't really\r\nmatch
anymore`\r\n\r\n\r\n\r\nhttps://github.com/user-attachments/assets/cf689b0e-4e07-4fd8-b5ec-74e3a4dea0f6\r\n\r\n\r\n###
Checklist\r\n\r\nDelete any items that are not applicable to this
PR.\r\n\r\n- [ ] Any text added follows [EUI's
writing\r\nguidelines](https://elastic.github.io/eui/#/guidelines/writing),
uses\r\nsentence case text and includes
[i18n\r\nsupport](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)\r\n-
[
]\r\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\r\nwas
added for features that require explanation or tutorials\r\n- [ ] [Unit
or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n- [ ] [Flaky
Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\r\nused on any tests changed\r\n- [ ] Any UI touched in this PR is
usable by keyboard only (learn more\r\nabout [keyboard
accessibility](https://webaim.org/techniques/keyboard/))\r\n- [ ] Any UI
touched in this PR does not create any new axe failures\r\n(run axe in
browser:\r\n[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),\r\n[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))\r\n-
[ ] If a plugin configuration key changed, check if it needs to
be\r\nallowlisted in the cloud and added to the
[docker\r\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\r\n-
[ ] This renders correctly on smaller devices using a
responsive\r\nlayout. (You can test this [in
your\r\nbrowser](https://www.browserstack.com/guide/responsive-testing-on-local-server))\r\n-
[ ] This was checked for
[cross-browser\r\ncompatibility](https://www.elastic.co/support/matrix#matrix_browsers)\r\n\r\nCo-authored-by:
Elastic Machine
<[email protected]>","sha":"76f6ec0f9bb4b3568e57273223f0e75912d06ce8","branchLabelMapping":{"^v9.0.0$":"main","^v8.17.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":[":ml","release_note:skip","v9.0.0","Feature:ML/AIOps","backport:version","v8.17.0"],"title":"[ML]
AIOps Log rate analysis: switch to Rerun analysis copy if search bar
search
changes","number":198179,"url":"https://github.com/elastic/kibana/pull/198179","mergeCommit":{"message":"[ML]
AIOps Log rate analysis: switch to Rerun analysis copy if search bar
search changes (#198179)\n\n## Summary\r\n\r\nRelated meta issue:
https://github.com/elastic/kibana/issues/196660\r\n\r\nCorresponds to
item: \r\n`UI: should switch to Rerun analysis copy if we change up the
search in\r\nthe search bar, otherwise hover data in the main chart
doesn't really\r\nmatch
anymore`\r\n\r\n\r\n\r\nhttps://github.com/user-attachments/assets/cf689b0e-4e07-4fd8-b5ec-74e3a4dea0f6\r\n\r\n\r\n###
Checklist\r\n\r\nDelete any items that are not applicable to this
PR.\r\n\r\n- [ ] Any text added follows [EUI's
writing\r\nguidelines](https://elastic.github.io/eui/#/guidelines/writing),
uses\r\nsentence case text and includes
[i18n\r\nsupport](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)\r\n-
[
]\r\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\r\nwas
added for features that require explanation or tutorials\r\n- [ ] [Unit
or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n- [ ] [Flaky
Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\r\nused on any tests changed\r\n- [ ] Any UI touched in this PR is
usable by keyboard only (learn more\r\nabout [keyboard
accessibility](https://webaim.org/techniques/keyboard/))\r\n- [ ] Any UI
touched in this PR does not create any new axe failures\r\n(run axe in
browser:\r\n[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),\r\n[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))\r\n-
[ ] If a plugin configuration key changed, check if it needs to
be\r\nallowlisted in the cloud and added to the
[docker\r\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\r\n-
[ ] This renders correctly on smaller devices using a
responsive\r\nlayout. (You can test this [in
your\r\nbrowser](https://www.browserstack.com/guide/responsive-testing-on-local-server))\r\n-
[ ] This was checked for
[cross-browser\r\ncompatibility](https://www.elastic.co/support/matrix#matrix_browsers)\r\n\r\nCo-authored-by:
Elastic Machine
<[email protected]>","sha":"76f6ec0f9bb4b3568e57273223f0e75912d06ce8"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/198179","number":198179,"mergeCommit":{"message":"[ML]
AIOps Log rate analysis: switch to Rerun analysis copy if search bar
search changes (#198179)\n\n## Summary\r\n\r\nRelated meta issue:
https://github.com/elastic/kibana/issues/196660\r\n\r\nCorresponds to
item: \r\n`UI: should switch to Rerun analysis copy if we change up the
search in\r\nthe search bar, otherwise hover data in the main chart
doesn't really\r\nmatch
anymore`\r\n\r\n\r\n\r\nhttps://github.com/user-attachments/assets/cf689b0e-4e07-4fd8-b5ec-74e3a4dea0f6\r\n\r\n\r\n###
Checklist\r\n\r\nDelete any items that are not applicable to this
PR.\r\n\r\n- [ ] Any text added follows [EUI's
writing\r\nguidelines](https://elastic.github.io/eui/#/guidelines/writing),
uses\r\nsentence case text and includes
[i18n\r\nsupport](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)\r\n-
[
]\r\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\r\nwas
added for features that require explanation or tutorials\r\n- [ ] [Unit
or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n- [ ] [Flaky
Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\r\nused on any tests changed\r\n- [ ] Any UI touched in this PR is
usable by keyboard only (learn more\r\nabout [keyboard
accessibility](https://webaim.org/techniques/keyboard/))\r\n- [ ] Any UI
touched in this PR does not create any new axe failures\r\n(run axe in
browser:\r\n[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),\r\n[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))\r\n-
[ ] If a plugin configuration key changed, check if it needs to
be\r\nallowlisted in the cloud and added to the
[docker\r\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\r\n-
[ ] This renders correctly on smaller devices using a
responsive\r\nlayout. (You can test this [in
your\r\nbrowser](https://www.browserstack.com/guide/responsive-testing-on-local-server))\r\n-
[ ] This was checked for
[cross-browser\r\ncompatibility](https://www.elastic.co/support/matrix#matrix_browsers)\r\n\r\nCo-authored-by:
Elastic Machine
<[email protected]>","sha":"76f6ec0f9bb4b3568e57273223f0e75912d06ce8"}},{"branch":"8.x","label":"v8.17.0","branchLabelMappingKey":"^v8.17.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Melissa Alvarez <[email protected]>
  • Loading branch information
kibanamachine and alvarezmelissa87 authored Nov 4, 2024
1 parent f7cf54d commit 22d742d
Showing 1 changed file with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ export const LogRateAnalysisResults: FC<LogRateAnalysisResultsProps> = ({
// to be able to track it across rerenders.
const analysisStartTime = useRef<number | undefined>(window.performance.now());
const abortCtrl = useRef(new AbortController());
const previousSearchQuery = useRef(searchQuery);

const [groupResults, setGroupResults] = useState<boolean>(false);
const [overrides, setOverrides] = useState<AiopsLogRateAnalysisSchema['overrides'] | undefined>(
Expand Down Expand Up @@ -386,6 +387,19 @@ export const LogRateAnalysisResults: FC<LogRateAnalysisResultsProps> = ({
[data.significantItemsGroups]
);

const searchQueryUpdated = useMemo(() => {
let searchQueryChanged = false;
if (
!isRunning &&
previousSearchQuery.current !== undefined &&
!isEqual(previousSearchQuery.current, searchQuery)
) {
searchQueryChanged = true;
}
previousSearchQuery.current = searchQuery;
return searchQueryChanged;
}, [searchQuery, isRunning]);

const shouldRerunAnalysis = useMemo(
() =>
currentAnalysisWindowParameters !== undefined &&
Expand Down Expand Up @@ -426,7 +440,7 @@ export const LogRateAnalysisResults: FC<LogRateAnalysisResultsProps> = ({
onRefresh={() => startHandler(false)}
onCancel={cancelHandler}
onReset={onReset}
shouldRerunAnalysis={shouldRerunAnalysis}
shouldRerunAnalysis={shouldRerunAnalysis || searchQueryUpdated}
analysisInfo={<LogRateAnalysisInfoPopover />}
>
<EuiFlexItem grow={false}>
Expand Down

0 comments on commit 22d742d

Please sign in to comment.