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: Tweak log rate changes in log rate analysis results table. #188648

Merged
merged 13 commits into from
Jul 23, 2024

Conversation

walterra
Copy link
Contributor

@walterra walterra commented Jul 18, 2024

Summary

Part of #187684.

This moves functions related to log rate changes to the @kbn/aiops_log_rate_analysis package.

  • getLogRateAnalysisType was renamed to getLogRateAnalysisTypeForHistogram to indicate its use with histogram data.
  • getLogRateAnalysisTypeForCounts was added for cases where we don't have the histogram data available but just the doc counts for baseline an deviation time ranges. This isn't used yet as of this PR but will be in a follow up in combination with the o11y AI assistant.
  • getSwappedWindowParameters is a helper to consolidate inline code that's used to swap baseline and deviation when we detected a dip in log rate.
  • Rounding for the log rate change messages was tweaked. Changes below 10x will now be rounded to one digit to avoid messages like 1x increase.
  • Tweaked/Shortened the message for 0 in baseline or deviation to just 45 up from 0 in baseline / down to 0 from 45 in baseline.

Checklist

@walterra walterra self-assigned this Jul 18, 2024
@walterra walterra added release_note:skip Skip the PR/issue when compiling release notes :ml Feature:ML/AIOps ML AIOps features: Change Point Detection, Log Pattern Analysis, Log Rate Analysis v8.16.0 labels Jul 18, 2024
@walterra walterra marked this pull request as ready for review July 18, 2024 13:53
@walterra walterra requested a review from a team as a code owner July 18, 2024 13:53
@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.

Other than a suggestion for a slight edit to the text, tested and LGTM

@walterra
Copy link
Contributor Author

walterra commented Jul 19, 2024

I noticed a bug how the log rate change text was calculated and updated. Because we always calculated it based on the window parameters selected in the chart, if you moved the brushes after the analysis was done, it would also update the text in the log rate change columns. I fixed it by moving currentAnalysisWindowParameters to the redux state to make it available for the columns so the calculation is always done on the values corresponding on what has been analysed. For clarity, I renamed the other windowParameters to chartWindowParameters to make the difference more obvious.

Before:

aiops-log-rate-analysis-column-update-0001

After:

aiops-log-rate-analysis-column-update-0002

Fixed in fb8a96d.

@elasticmachine
Copy link
Contributor

elasticmachine commented Jul 19, 2024

💔 Build Failed

Failed CI Steps

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
aiops 634 636 +2
dataVisualizer 791 794 +3
total +5

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
aiops 554.7KB 555.5KB +774.0B
Unknown metric groups

API count

id before after diff
@kbn/aiops-log-rate-analysis 54 66 +12

History

cc @walterra

@@ -80,7 +85,12 @@ export const logRateAnalysisResultsSlice = createSlice({
resetGroups: (state) => {
state.significantItemsGroups = [];
},
resetAll: () => getDefaultState(),
// reset the results but keeps
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: unfinished comment explanation?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for spotting this! Fixed in 6941aa7.

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.

LGTM ⚡

@walterra walterra added the bug Fixes for quality problems that affect the customer experience label Jul 23, 2024
@kibana-ci
Copy link
Collaborator

💛 Build succeeded, but was flaky

Failed CI Steps

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
aiops 634 636 +2
dataVisualizer 791 794 +3
total +5

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
aiops 554.9KB 555.6KB +774.0B
Unknown metric groups

API count

id before after diff
@kbn/aiops-log-rate-analysis 54 66 +12

History

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

cc @walterra

@walterra walterra merged commit dffc044 into elastic:main Jul 23, 2024
23 checks passed
@kibanamachine kibanamachine added the backport:skip This commit does not require backporting label Jul 23, 2024
@walterra walterra deleted the ml-aiops-log-rate-change-fixes branch July 23, 2024 08:25
walterra added a commit that referenced this pull request Jul 30, 2024
…from analysis (not just grouping) (#188913)

## Summary

Part of #187684.

So far the popover to filter fields was only available when grouping was
enabled. This PR updates the behavior so it's available all the time and
can be used to exclude field candidates from the analysis. If we detect
the index to be based on an ECS schema, we auto-select a set of
predefined fields.

Changes in this PR:

- Creates a new route
`/internal/aiops/log_rate_analysis/field_candidates` to be able to fetch
field candidates independent of the main streaming API call.
- Fixes the code to consider "remaining" field candidates to also
consider text field candidates. This was originally developed to allow
to continue an analysis that errored for some reason. We use that option
to also pass on the custom field list from the field selection popover.
- Fetching the field candidates is done in a new redux slice
`logRateAnalysisFieldCandidatesSlice` using an async thunk.
- Filters the list of field candidates by a predefined field of allowed
fields when an ECS schema gets detected.
- Renames `fieldCandidates` to `keywordFieldCandidates` for clearer
distinction against `textFieldCandidates`.
- Refactors `getLogRateAnalysisTypeForCounts` args to a config object.
- Bump the API version for the full log rate analysis to version 3. We
missed bumping the version in
#188648. This update manages
proper versioning between v2 and v3, also the API integration tests
cover both versions.


[aiops-log-rate-analysis-fields-filter-0001.webm](https://github.com/user-attachments/assets/e3ed8d5b-f01c-42ef-8033-caa7135b8cc0)

### Checklist

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [ ] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
- [x] This was checked for breaking API changes and was [labeled
appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)
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 bug Fixes for quality problems that affect the customer experience Feature:ML/AIOps ML AIOps features: Change Point Detection, Log Pattern Analysis, Log Rate Analysis :ml release_note:skip Skip the PR/issue when compiling release notes v8.16.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants