Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ML] AIOps Log Rate Analysis: Merge fetch queue for keyword and text field candidates. #183649

Merged
merged 2 commits into from
May 21, 2024

Conversation

walterra
Copy link
Contributor

@walterra walterra commented May 16, 2024

Summary

Part of #181111.

So far we identified significant text field candidates before keyword field candidates. There were 2 problems with this: 1) The loading behaviour for text fields was not considered in the progress bar. 2) Analysing a text field can be quite slow we weren't taking advantage of the same queue we used to fetch keyword fields. If it was taking quite a while to analysis the text fields, it would appear the progress bar was "stuck". And we had to wait to finish those slow queries before we started fetching p-values for keyword fields.

This PR improves the behaviour by adding text field fetching to the same queue that fetches keyword fields. This means while a maybe slower text field is analysed, we can continue to fetch keyword based fields in parallel given the max concurrency.

It's a bit tricky to test because with the local datasets the analysis might be so fast you won't notice a difference. So for testing you could do the following: In the file significant_items_handler.ts at the top add:

const delay = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms));

And further down around line 110 add the following delay:

   const pValuesQueue = queue(async function (payload: Candidate) {
      await delay(Math.random() * 10000);

      if (isFieldCandidate(payload)) {
 ...

This will randomly delay the next call for the text/keyword field so you should see the progress bar moving. The difference to before would be that the progress bar would not move while it analyses the text fields.

Checklist

@walterra walterra added release_note:enhancement :ml Feature:ML/AIOps ML AIOps features: Change Point Detection, Log Pattern Analysis, Log Rate Analysis v8.15.0 labels May 16, 2024
@walterra walterra self-assigned this May 16, 2024
@walterra walterra requested a review from a team as a code owner May 16, 2024 14:12
@elasticmachine
Copy link
Contributor

Pinging @elastic/ml-ui (:ml)

Copy link
Contributor

@peteharverson peteharverson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Tested using the added delay in the significant items handler and could see the progress bar update while analysing text fields.

Copy link
Contributor

@alvarezmelissa87 alvarezmelissa87 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code LGTM ⚡

@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

✅ unchanged

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

cc @walterra

@walterra walterra merged commit 4c9d65b into elastic:main May 21, 2024
17 checks passed
@kibanamachine kibanamachine added the backport:skip This commit does not require backporting label May 21, 2024
@walterra walterra deleted the ml-aiops-fix-field-candidates-queue branch May 21, 2024 09:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting Feature:ML/AIOps ML AIOps features: Change Point Detection, Log Pattern Analysis, Log Rate Analysis :ml release_note:enhancement v8.15.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants