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] Explain log rate spikes: Add field histograms to analysis result. #136295

Merged
merged 15 commits into from
Jul 20, 2022

Conversation

walterra
Copy link
Contributor

@walterra walterra commented Jul 13, 2022

Summary

Part of #136265.

  • 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.

image

Checklist

@walterra walterra added :ml release_note:skip Skip the PR/issue when compiling release notes v8.4.0 labels Jul 13, 2022
@walterra walterra self-assigned this Jul 13, 2022
@walterra walterra force-pushed the ml-aiops-field-histograms-api branch from 273cda7 to 1488117 Compare July 18, 2022 15:05
@walterra walterra marked this pull request as ready for review July 18, 2022 15:59
@walterra walterra requested a review from a team as a code owner July 18, 2022 15:59
@elasticmachine
Copy link
Contributor

Pinging @elastic/ml-ui (:ml)

x-pack/packages/ml/agg_utils/src/types.ts Show resolved Hide resolved
updateLoadingStateAction({
ccsWarning: false,
loaded: 1,
loadingState: `Done.`,
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this string of text displayed to the user in the UI?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added an item to the meta issue to translate those messages, there are more from previous PRs too. #136265

updateLoadingStateAction({
ccsWarning: false,
loaded,
loadingState: `Loading histogram data.`,
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this displayed in the UI?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added an item to the meta issue to translate those messages, there are more from previous PRs too. #136265

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. Just added a few minor comments on the code.

stackAccessors={[0]}
/>
<BarSeries
id={`${label}`}
Copy link
Member

Choose a reason for hiding this comment

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

Since label is already a string, we can simplify it to id={label} here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 959edc2.

<Chart>
<Settings theme={theme} showLegend={false} />
<BarSeries
id="Other"
Copy link
Member

Choose a reason for hiding this comment

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

Super duper nit: this id should be lowercase to be consistent with others

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 catch, the "Other" in this BarSeries was wrong anyway, changed it to doc_count_overall. Fixed in 959edc2.

@@ -174,125 +115,11 @@ type BatchStats =
| FieldExamples;

// export for re-use by transforms plugin
Copy link
Member

Choose a reason for hiding this comment

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

I think we can remove this comment here now

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 959edc2.

@@ -119,7 +118,10 @@ export const SpikeAnalysisTable: FC<Props> = ({ changePointData, error, loading
<EuiBasicTable
compressed
columns={columns}
items={pageOfItems ?? []}
// Temporary default sorting by ascending pValue until we add native table sorting
items={pageOfItems.sort((a, b) => {
Copy link
Member

Choose a reason for hiding this comment

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

We should move this temporary default sort into the useMemo hook for pageOfItems so it doesn't get re-sorted and re-rendered every time.

Copy link
Contributor Author

@walterra walterra Jul 19, 2022

Choose a reason for hiding this comment

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

Fixed in 959edc2.

@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
aiops 284 285 +1
dataVisualizer 365 366 +1
ml 1624 1625 +1
transform 319 320 +1
total +4

Public APIs missing comments

Total count of every public API that lacks a comment. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats comments for more detailed information.

id before after diff
@kbn/ml-agg-utils 18 35 +17
ml 78 71 -7
total +10

Any counts in public APIs

Total count of every any typed public API. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats any for more detailed information.

id before after diff
@kbn/ml-agg-utils 1 2 +1
ml 10 9 -1
total -0

Async chunks

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

id before after diff
aiops 424.5KB 425.2KB +733.0B
dataVisualizer 545.2KB 547.4KB +2.2KB
ml 3.3MB 3.3MB +2.1KB
transform 383.2KB 385.4KB +2.2KB
total +7.2KB

Public APIs missing exports

Total count of every type that is part of your API that should be exported but is not. This will cause broken links in the API documentation system. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats exports for more detailed information.

id before after diff
@kbn/ml-agg-utils 0 4 +4
ml 31 30 -1
total +3
Unknown metric groups

API count

id before after diff
@kbn/ml-agg-utils 21 53 +32
ml 251 244 -7
total +25

History

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

cc @walterra

@walterra walterra merged commit 092fb35 into elastic:main Jul 20, 2022
@kibanamachine kibanamachine added the backport:skip This commit does not require backporting label Jul 20, 2022
@walterra walterra deleted the ml-aiops-field-histograms-api branch July 20, 2022 09:44
@walterra
Copy link
Contributor Author

If you have suggestions for follow ups please feel free to add them to the meta issue: #136265

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 :ml release_note:skip Skip the PR/issue when compiling release notes v8.4.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants