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] Persist URL state for Anomaly detection jobs using metric function #83507

Merged
merged 10 commits into from
Nov 18, 2020

Conversation

qn895
Copy link
Member

@qn895 qn895 commented Nov 17, 2020

Summary

This PR is a follow up of #81662. It brings several improvements such as:

  • Persist the function description if the function is of type metric (for when user bookmarks or refreshes the page)
  • Avoid double fetching due to stale or unknown function description. Previously, switching to another detector and then back to the metric detector will fetch the aggregation data twice due to race condition.

Behavior

By default, when first viewing the job in the Single Metric Viewer, it will pick the function description associated with the highest anomaly scoring record. In this example, the view defaults to min.
start_as_min

Upon changing the plotting function and refresh of the page, the view will be persisted to the previously selected function.
retained_as_max

Checklist

Delete any items that are not applicable to this PR.

@qn895 qn895 added Feature:Anomaly Detection ML anomaly detection v8.0.0 release_note:skip Skip the PR/issue when compiling release notes v7.11.0 labels Nov 17, 2020
@qn895 qn895 requested a review from a team as a code owner November 17, 2020 00:20
@qn895 qn895 self-assigned this Nov 17, 2020
}: {
functionDescription: undefined | string;
setFunctionDescription: (func: string) => void;
selectedDetectorIndex: any;
selectedJobId: string;
selectedEntities: Record<string, any>;
Copy link
Contributor

Choose a reason for hiding this comment

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

Could it be a more specific type?

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated here 607d788

Copy link
Contributor

Choose a reason for hiding this comment

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

@qn895 can't find it in the commit hash you've mentioned

Copy link
Member Author

Choose a reason for hiding this comment

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

Not sure why Github is being weird but it's https://github.com/elastic/kibana/pull/83507/commits/607d7880884564514d8fb34b4972bc4ab644ea75

@elasticmachine
Copy link
Contributor

Pinging @elastic/ml-ui (:ml)

Copy link
Contributor

@darnautov darnautov left a comment

Choose a reason for hiding this comment

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

LGTM, just some minor issues left

Comment on lines +52 to +55
_selectedDetectorIndex: number,
_selectedEntities: Record<string, any>,
_selectedJobId: string,
_selectedJob: CombinedJob
Copy link
Contributor

Choose a reason for hiding this comment

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

I believe you don't need it and can access these arguments from the component scope

Copy link
Member Author

Choose a reason for hiding this comment

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

I think doing that will require the callback to depend on those arguments, and since they are the same as the original effect we're splitting it from, I don't see the benefits of either moving it outside of the effect or using the arguments from component scope.

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.

Tested and LGTM

@qn895
Copy link
Member Author

qn895 commented Nov 18, 2020

@elasticmachine merge upstream

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
ml 1565 1566 +1

Async chunks

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

id before after diff
ml 5.2MB 5.2MB +1017.0B

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
ml 67.3KB 67.4KB +144.0B

History

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

@qn895 qn895 merged commit 77da781 into elastic:master Nov 18, 2020
@qn895 qn895 deleted the ml-metric-saving-func-desc-in-url branch November 18, 2020 16:57
qn895 added a commit to qn895/kibana that referenced this pull request Nov 18, 2020
…on (elastic#83507)

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
phillipb added a commit to phillipb/kibana that referenced this pull request Nov 19, 2020
… into add-logs-to-node-details

* 'add-logs-to-node-details' of github.com:phillipb/kibana: (87 commits)
  [Maps] Add 'crossed' & 'exited' events to tracking alert (elastic#82463)
  Updating code-owners to use new core/app-services team names (elastic#83731)
  Add Managed label to data streams and a view switch for the table (elastic#83049)
  [Maps] Add query bar inputs to geo threshold alerts tracked points & boundaries (elastic#80871)
  fix(NA): search examples kibana version declaration (elastic#83182)
  Fixed console error, which appears when saving changes in Edit Alert flyout (elastic#83610)
  [Alerting] Add `alert.updatedAt` field to represent date of last user edit (elastic#83578)
  Not resetting server log level if level is defined (elastic#83651)
  disable incremenetal build for legacy tsconfig.json (elastic#82986)
  [Workplace Search] Migrate SourceLogic from ent-search (elastic#83593)
  [Workplace Search] Port Box changes from ent-search (elastic#83675)
  [APM] Improve router types (elastic#83620)
  Bump flat to v4.1.1 (elastic#83647)
  Bump y18n@5 to v5.0.5 (elastic#83644)
  Bump jsonpointer to v4.1.0 (elastic#83641)
  Bump is-my-json-valid to v2.20.5 (elastic#83642)
  [Telemetry] Move Monitoring collection strategy to a collector (elastic#82638)
  Update typescript eslint to v4.8 (elastic#83520)
  [ML] Persist URL state for Anomaly detection jobs using metric function (elastic#83507)
  [ML] Performance improvements to annotations editing in Single Metric Viewer & buttons placement (elastic#83216)
  ...
chrisronline pushed a commit to chrisronline/kibana that referenced this pull request Nov 19, 2020
…on (elastic#83507)

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
qn895 added a commit that referenced this pull request Nov 19, 2020
…function (#83507) (#83673)

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Anomaly Detection ML anomaly detection :ml release_note:skip Skip the PR/issue when compiling release notes v7.11.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants