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: Adds support to restore baseline/deviation from url state on page refresh #171398

Merged

Conversation

walterra
Copy link
Contributor

@walterra walterra commented Nov 16, 2023

Summary

Part of #146166.

Support to restore baseline/deviation time ranges from url state on full page refresh.

Also updates functional tests to include a full page refresh after the first analysis run for each dataset.

aiops-log-rate-analysis-url-state-0001

Checklist

@walterra walterra self-assigned this Nov 16, 2023
@walterra walterra added release_note:enhancement :ml v8.12.0 Feature:ML/AIOps ML AIOps features: Change Point Detection, Log Pattern Analysis, Log Rate Analysis labels Nov 16, 2023
@walterra walterra marked this pull request as ready for review November 16, 2023 13:24
@walterra walterra requested a review from a team as a code owner November 16, 2023 13:24
@elasticmachine
Copy link
Contributor

Pinging @elastic/ml-ui (:ml)

@walterra walterra requested review from alvarezmelissa87 and removed request for jgowdyelastic November 16, 2023 14:22
@@ -15,25 +15,13 @@ import { isPopulatedObject } from '@kbn/ml-is-populated-object';
* @typedef {WindowParameters}
*/
export interface WindowParameters {
/**
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed the JSDoc type annotations here because it's overly verbose and isn't needed to satisfy the docs script. There's also not really an IDE/Intellisense benefit when the file is TS anyway.

*/

import { getDefaultAiOpsListState, type AiOpsFullIndexBasedAppState } from './common';

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This file was broke out from above application/url_state/common.ts

@peteharverson peteharverson changed the title [ML] [AIOps] Log Rate Analysis: Support to restore baseline/deviation from url state on page refresh. [ML] [AIOps] Log Rate Analysis: Adds support to restore baseline/deviation from url state on page refresh. Nov 20, 2023
/**
* Transforms a full window parameters object to the abbreviated url state version.
*/
export const windowParameters2AppState = (wp?: WindowParameters): LogRateAnalysisAppState['wp'] =>
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it worth doing any basic validation of the parameters? For example, here I manually edited the URL so that the baseline / deviation were outside the page time range:

image

Admittedly this is an edge case, so maybe not worth the extra work?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I documented this in a separate issue to follow up with: #171657

The problem here is that the full time range doesn't include any data, we should recognize that and not show the brushes and UI below at all since there will be no results anyway. So this can happen by updating the date picker too, it's sort of unrelated to the url state update.

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

/**
* Transforms an abbreviated url state version of window parameters to its full version.
*/
export const appState2WindowParameters = (
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: I think we should keep function names clear and consistent - imo it would be preferable to have a slightly longer function name appStateToWindowParameters than to introduce a number that has no meaning but to take the place of a word.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good suggestion, updated in 907d63b.

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.

Left a small comment but overall LGTM ⚡

@walterra walterra enabled auto-merge (squash) November 22, 2023 11:17
@kibana-ci
Copy link
Collaborator

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] FTR Configs #66 / Serverless Common UI - Management Data View Management "before all" hook in "Data View Management"

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
aiops 419 421 +2

Async chunks

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

id before after diff
aiops 376.5KB 376.9KB +357.0B

History

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

cc @walterra

@walterra walterra merged commit 19e97f3 into elastic:main Nov 22, 2023
@kibanamachine kibanamachine added the backport:skip This commit does not require backporting label Nov 22, 2023
@walterra walterra deleted the 146166-ml-aiops-log-rate-analysis-url-state branch November 24, 2023 10:53
@szabosteve szabosteve changed the title [ML] [AIOps] Log Rate Analysis: Adds support to restore baseline/deviation from url state on page refresh. [ML] [AIOps] Log Rate Analysis: Adds support to restore baseline/deviation from url state on page refresh Dec 8, 2023
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.12.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants