Commit graph

278 commits

Author SHA1 Message Date
Walter Rafelsberger
70efbf0ea3
[ML] Explain Log Rate Spikes: Fix error handling. (#137947)
- Errors on the application level were not correctly surfaced in the UI. This PR fixes it by combining "transport" stream errors and application errors in a callout above the analysis results table.
- This also fixes the problem where a partly populated results table would turn empty again when used with the error prop of EUI's table. We now keep the table on display an show the errors above it in the callout.
2022-08-04 15:23:36 +02:00
Melissa Alvarez
b17579afa3
[ML] Explain log rate spikes: Fix data out of date when brush selection changes (#137791)
* update run analysis button content when selection changges

* fix brush overlap causing endless rerender

* [CI] Auto-commit changed files from 'node scripts/precommit_hook.js --ref HEAD~1..HEAD --fix'

* fix resize triggering rerun analysis prompt

* [CI] Auto-commit changed files from 'node scripts/precommit_hook.js --ref HEAD~1..HEAD --fix'

* add comments to getSnappedWindowParameters function

* use memo instead of using component state

* [CI] Auto-commit changed files from 'node scripts/precommit_hook.js --ref HEAD~1..HEAD --fix'

* fix eslint error and simplify usememo callback

* [CI] Auto-commit changed files from 'node scripts/precommit_hook.js --ref HEAD~1..HEAD --fix'

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2022-08-03 12:11:15 -04:00
Walter Rafelsberger
cd7578a26e
[ML] Explain Log Rate Spikes: Fix loading behavior. (#137873)
- Fixes API messages and loading state to always finish with 100% except when a user cancels the request.
- Fix to never apply loading={true} to the analysis table because it disables hovering events. To indicate loading we have the overall progress bar anyway.
- When the analysis returns no results, instead of an empty table and just the "no data" message, this now hides the table and displays an EuiEmptyPrompt.
2022-08-03 16:43:35 +02:00
Walter Rafelsberger
8edde86337
[ML] Fix check for time field based data view. (#137784)
Fixes the check to allow only data views with time fields for the Explain Log Rate Spikes UI. Previously the check was done on an outer component and didn't reach the component that would display an error message, the user ended up with an empty page. Instead of a non-working UI and an error message in a toast, this now hides the entire UI and just displays an error callout component.
2022-08-02 18:05:13 +02:00
Walter Rafelsberger
24de6906b5
[ML] Explain log rate spikes: Fix race conditions when loading document count stats. (#137715)
- Fixes a race condition when loading document count stats for the histogram charts. Previously, data for the splitted histogram were loaded with to custom hooks in parallel which meant data in the chart could end up out of sync when transitioning from one state to the other.
- Fixes another race condition where stale data fetched via hovering would populate the chart late. This was fixed by adding abort signals to the data fetching hooks.
- Adds caching to the data fetched via hovering the analysis table rows.
2022-08-02 10:58:02 +02:00
Walter Rafelsberger
ee6d46972f
[ML] Explain log rates spikes: Fix API messages translations. (#137589)
Adds translations to API status messages to fix singular/plural issues with dynamic messages.
2022-08-01 16:53:05 +02:00
Quynh Nguyen
7778027cd7
[ML] Fix Data visualizer globally pinned filters not saved and query search bar not cleared properly (#136897)
* Save globally pinned filters and set merged query to handle empty strings

* Retain filters coming from other apps

* Fix same issues for aiops

* Fix tests

* Add named functions clearFiltersOnLeave

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2022-07-28 13:59:24 -05:00
Walter Rafelsberger
3117f671e2
[ML] Explain log rate spikes: Mini histogram fixes. (#137266)
- Disables tooltips in mini histograms to avoid bug with sticky tooltips and to be in line with APM sparkline behavior.
- Fix to set mini histogram background to transparent so the chart background picks up the background of a hovered table row.
- Fix some hard coded values by using values provided by EUI.
- Fixes an issue where histograms were assigned to the wrong table rows.
- Support for loading indicator and empty chart state.
- Tweaks analysis table column widths.
2022-07-28 17:33:12 +02:00
Melissa Alvarez
4027e977b0
[ML] Explain log rate spikes: adds table sorting (#137110)
* add sorting for table

* update analysis refresh button copy

* [CI] Auto-commit changed files from 'node scripts/precommit_hook.js --ref HEAD~1..HEAD --fix'

* add info tooltips for p-value, log rate, and impact columns

* update tooltip copy

* [CI] Auto-commit changed files from 'node scripts/precommit_hook.js --ref HEAD~1..HEAD --fix'

* update types and simplify tooltip content

* make sort case insensitive

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2022-07-26 14:08:38 -04:00
Walter Rafelsberger
97c0b32159
[ML] Explain log rate spikes: Improve analysis workflow. (#137192)
- Adds an empty prompt when there's no current selection to describe the necessary click action and some general feature description.
- Adds an option to clear the current selection and start from scratch.
- Adds badges to the brush areas to label them as Baseline and Deviation.
- Adds EuiPanel as wrappers for the chart and table sections. The distinct sections make it easier to identify to which context an action like the analysis refresh button refers.
2022-07-26 18:54:42 +02:00
Walter Rafelsberger
bd9955a396
[ML] Explain log rate spikes: Fix data view title. (#137053)
- Use dataView.getName() instead of dataView.title.
- Adds missing scss brought over from Data Visualizer to improve positioning of long Data View names.
2022-07-26 13:44:57 +02:00
Walter Rafelsberger
e9d9c69757
[ML] Explain log rate spikes: Split main chart by selected field/value pair. (#136712)
- Adds the ability to show the hovered/selected field/value pair in the main chart.
- Optional search queries now get applied to the analysis.
2022-07-22 16:16:19 +02:00
Melissa Alvarez
c3ac0a163a
[ML] Log rate spike: support saved search (#136765)
* add support for saved search

* move analysis table and progress to separate component

* fix types

* ensure filters from saved search show up correctly
2022-07-22 08:49:45 -04:00
Melissa Alvarez
59082823ed
[ML] Log rate spike: search (#136571)
* add search bar with filters

* create application directory and utils directory

* incorporate cache fix and ensure search works

* move search above table and fix type errors

* refactor to minimize start bundle

* update branch with latest changes and fix types

* add comments to track duplicate code
2022-07-20 14:34:18 -04:00
Walter Rafelsberger
092fb354ec
[ML] Explain log rate spikes: Add field histograms to analysis result. (#136295)
- Extends the analysis API to return histogram data.
- Adds a column with MiniHistogram components to the analysis results table.
- Moves/consolidates fetchHistogramsForFields to @kbn/ml-agg-utils (also used in Data Visualizer and Data Grid Mini Histograms).
- So far fetchHistogramsForFields auto-identified the necessary interval and min/max. To be able to generate histogram data for the log rate spikes charts an options was added to use that information up front for the data to be fetched. This allows the buckets for the chart data for the overall (green bars) and the field/value-filtered (orange bars) histogram to have the exact same buckets.
2022-07-20 11:44:19 +02:00
Walter Rafelsberger
b264dbcb0a
[ML] Explain log rate spikes: Fix hooks caching. (#136645)
Fixes issues where hooks would return stale data (index pattern, time ranges, total docs etc.).
2022-07-19 18:17:38 +02:00
Tiago Costa
302bd423f3
chore(NA): eslint rule for disallowing naked eslint-disable (#136408)
* chore(NA): eslint rule for disallowing naked eslint-disable

* chore(NA): export new rule and update docs

* chore(NA): creation of rule in ts

* chore(NA): new corrected rule in ts

* refact(NA): remove old logic from older plugin

* docs(NA): update documentation

* docs(NA): update documentation

* docs(NA): update documentation

* refact(NA): include edge cases for better locating errors

* chore(NA): changed regex name

* docs(NA): correct name rule on docs

* refact(NA): use dedent in the template literals

* refact(NA): check for undefined

* fix(NA): introduces support for eslint-disable-line

* chore(NA): fix extra space

* test(NA): created more test cases

* chore(NA): rename plugin to eslint-plugin-disable

* docs(NA): update nav and operations landing page ids for eslint rule

* test(NA): use messageIds on test

* chore(NA): complete naked eslint disables with specific rules

* chore(NA): specific rules for a few naked eslint disable

* chore(NA): add focused eslint disable on big reindex_operation_with_large_error_message.ts file

* chore(NA): changes according PR feedback

* chore(NA): include specific eslint rules on latest naked eslint disable

* chore(NA): missing eslint disable specific rule

* fix(NA): remove comment for js annotator

* chore(NA): re add eslint focused disable rule to x-pack/plugins/osquery/cypress/support/coverage.ts

* chore(NA): re add eslint focused disable rule to x-pack/plugins/osquery/cypress/support/coverage.ts

* chore(NA): re add eslint focused disable rule to x-pack/plugins/osquery/cypress/support/coverage.ts

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2022-07-19 17:11:04 +01:00
Walter Rafelsberger
00216fd0b7
[ML] Explain log rate spikes: Use DualBrush component to select WindowParameters for analysis. (#136255)
- Adds the DualBrush component to DocumentCountChart to allow the user to select WindowParameters for the explain log rate spikes analysis.
- VIEW_MODE is for now hard coded to brush. In a follow up we will allow a user to switch between zoom mode for navigation and brush mode for selection of WindowParameters.
- The auto-generation of WindowParameters has been removed from the wrapping code in the ML plugin.
- urlState related code has been moved from ExplainLogRateSpikes to ExplainLogRateSpikesWrapper.
- The analysis results table style has been changed to compressed.
2022-07-13 18:05:19 +02:00
Walter Rafelsberger
43b16a9ef7
[ML] Explain log rate spikes: Fix state reset on refetch. (#136177)
Adds a fix to reset the state when a user restarts the analysis.
2022-07-13 10:48:18 +02:00
Melissa Alvarez
4ad614c578
[ML] Explain log rate spikes: UI Part 1 (#135948)
* wip: create initial use full data and log spike table and histogram chart

* wip: adds timepicker and use full data complete functionality

* ensure time selectin persists in url

* [CI] Auto-commit changed files from 'node scripts/precommit_hook.js --ref HEAD~1..HEAD --fix'

* add impact and score bar to table

* fix filename typo

* add lazy component wrapper, fix translation naming

* update type names

* remove duplicate code

* update error type

* rename overall stats hook to doccountstats hook

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2022-07-12 14:35:50 -04:00
Walter Rafelsberger
b65f0bd122
[ML] Add TODO comments about possible code consolidation. (#136181) 2022-07-12 13:15:28 +02:00
Walter Rafelsberger
04907932c4
[ML] Explain log rate spikes: Add DualBrush component. (#135318)
Adds the code for the dual brush component for users to be able select log rate spikes in histogram charts.
For this PR a new package @kbn/aiops-components was created that also includes ProgressControls from @kbn/aiops-utils now. The reason for this is: The brush component includes code from d3 that cannot be imported on the server side which aiops-utils was also used for.
2022-07-06 14:08:05 +02:00
Walter Rafelsberger
d50434ed7b
[ML] Explain log rate spikes: Adds API license check. (#135431)
- Adds a check to aiops API endpoints to only allow requests with active platinum license.
- Adds integration tests for basic license where the endpoints should return permission denied.
- Improved error handling:
 - Low level errors (like a non valid argument pushed to a stream) will now be logged to Kibana server's console, because the way HTTP streams work we cannot really emit a useful error to an already running stream to the client. So the stream will just abort but Kibana server will log an error.
 - Higher level errors on the application level (like when we find out an index does not exist to run the analysis) will be pushed to the stream now as an error type action and we can update the UI accordingly. Note this PR only updates the API and corresponding tests to support this, the UI doesn't make use of it yet.
2022-06-30 15:32:31 +02:00
Walter Rafelsberger
a0f69e0e43
[ML] Explain log rate spikes: Analysis API endpoint. (#135058)
Updates the API endpoint "/internal/aiops/explain_log_rate_spikes" to work with real data instead of the dummy example.

The analysis now includes identifying field candidates and statistically significant field value pairs. Because there is no UI in place yet to allow a user to select custom time ranges for baseline and deviation, for now we fetch a date histogram of the selected index pattern and identify the parameters to get passed as WindowParameters automatically by picking the part of the date histogram with the highest doc count.

This PR is more about getting the API endpoint into shape and updates integration tests too. The UI code should be considered temporary. At the moment it just outputs the returned analysis state as raw JSON in a EUI code block.
2022-06-28 13:26:09 +02:00
Walter Rafelsberger
c968e508f6
[ML] Explain log rate spikes: Move API stream demos to Kibana examples. (#132590)
This creates a response_stream plugin in the Kibana /examples section. The plugin demonstrates API endpoints that can stream data chunks with a single request with gzip/compression support. gzip-streams get decompressed natively by browsers. The plugin demonstrates two use cases to get started: Streaming a raw string as well as a more complex example that streams Redux-like actions to the client which update React state via useReducer().
2022-05-24 16:59:31 +02:00
Walter Rafelsberger
b3aee1740b
[ML] Disable AIOps UI/APIs. (#132589)
This disables the UI and APIs for Explain log rate spikes in the ML plugin since it will not be part of 8.3. Once 8.3 has been branched off, we can reenable it in main. This also adds a check to the API integration tests to run the tests only when the hard coded feature flag is set to true.
2022-05-20 12:56:03 +02:00
Walter Rafelsberger
24bdc97413
[ML] Explain log rate spikes: Page setup (#132121)
Builds out UI/code boilerplate necessary before we start implementing the feature's own UI on a dedicated page.

- Updates navigation to bring up data view/saved search selection before moving on to the explain log spike rates page.
The bar chart race demo page was moved to the aiops/single_endpoint_streaming_demo url. It is kept in this PR so we have two different pages + API endpoints that use streaming. With this still in place it's easier to update the streaming code to be more generic and reusable.
- The url/page aiops/explain_log_rate_spikes has been added with some dummy request that slowly streams a data view's fields to the client. This page will host the actual UI to be brought over from the PoC in follow ups to this PR.
- The structure to embed aiops plugin pages in the ml plugin has been simplified. Instead of a lot of custom code to load the components at runtime in the aiops plugin itself, this now uses React lazy loading with Suspense, similar to how we load Vega charts in other places. We no longer initialize the aiops client side code during startup of the plugin itself and augment it, instead we statically import components and pass on props/contexts from the ml plugin.
- The code to handle streaming chunks on the client side in stream_fetch.ts/use_stream_fetch_reducer.ts has been improved to make better use of TS generics so for a given API endpoint it's able to return the appropriate coresponding return data type and only allows to use the supported reducer actions for that endpoint. Buffering client side actions has been tweaked to handle state updates more quickly if updates from the server are stalling.
2022-05-20 10:45:50 +02:00
Walter Rafelsberger
6df1b28a82
[ML] Explain log rate spikes: Plugin setup (#131317)
Sets up the boilerplate code for the aiops plugin and adds a demo page within the ML app to demonstrate single API request data streaming from Kibana server to UI client.
2022-05-12 13:36:53 +02:00