Skip to content

[APM] Add ML expected model bounds as an option to Comparison controls - #132456

Merged
qn895 merged 41 commits into
elastic:mainfrom
qn895:apm-comparison-ml-expected-bounds
May 24, 2022
Merged

qn895 merged 41 commits into
elastic:mainfrom
qn895:apm-comparison-ml-expected-bounds

Conversation

@qn895

@qn895 qn895 commented May 18, 2022 •

Copy link
Copy Markdown
Member

Summary

This PR addresses #121520 and adds an option to show ML model bounds in the comparison controls and re-enable the expected bounds from ML anomaly detection jobs as comparison option to Latency, Throughput, and Failed Transaction Rate charts.

If user can access machine learning jobs, but there are no* ML jobs that match the currently selected environment, the Expected bounds option will be shown but will be disabled:
Screen Shot 2022-05-20 at 17 43 51

When user can access machine learning jobs, and there are ML jobs that match the current environment, Expected bounds will be enabled:
Screen Shot 2022-05-20 at 17 43 40

When Expected bounds is selected for comparison:
Screen Shot 2022-05-20 at 17 55 23

When switching environment, and there are no ML jobs that match the new environment, Expected bounds will be disabled, and the current selection will default to the first available time comparison option.

Screen.Recording.2022-05-20.at.17.55.28.mov

When a time range comparison is used, the legend for the charts will show Comparison: Day before Comparison: Week before, or Comparison: {period of time}`. Additionally, tooltip will no longer show series with N/A or null values.

Screen Shot 2022-05-20 at 17 56 34

Checklist

Delete any items that are not applicable to this PR.

Risk Matrix

Delete this section if it is not applicable to this PR.

Before closing this PR, invite QA, stakeholders, and other developers to identify risks that should be tested prior to the change/feature release.

When forming the risk matrix, consider some of the following examples and how they may potentially impact the change:

Risk Probability Severity Mitigation/Notes
Multiple Spaces—unexpected behavior in non-default Kibana Space. Low High Integration tests will verify that all features are still supported in non-default Kibana Space and when user switches between spaces.
Multiple nodes—Elasticsearch polling might have race conditions when multiple Kibana nodes are polling for the same tasks. High Low Tasks are idempotent, so executing them multiple times will not result in logical error, but will degrade performance. To test for this case we add plenty of unit tests around this logic and document manual testing procedure.
Code should gracefully handle cases when feature X or plugin Y are disabled. Medium High Unit tests will verify that any feature flag or plugin combination still results in our service operational.
See more potential risk examples

For maintainers

@qn895 qn895 changed the title [APM] Add ML expected bounds [APM] Add ML expected model bounds as an option to Comparison controls May 18, 2022
@qn895 qn895 self-assigned this May 18, 2022
@qn895
qn895 marked this pull request as ready for review May 18, 2022 20:43
@qn895
qn895 requested a review from a team May 18, 2022 20:43
@elasticmachine

Copy link
Copy Markdown
Contributor

Pinging @elastic/ml-ui (:ml)

@peteharverson peteharverson left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Tested and LGTM with the lower bounds of the ML model plot now displaying correctly.

I don't think we should look to display the model bounds in the sparklines shown in the Services list and Map at this stage. Those searches need to be optimized for speed for which we should investigate using sampling. Also with the limited width and height of the sparklines there may be little value in trying to show model bounds here.

@sophiec20

Copy link
Copy Markdown
Contributor

++ agree that showing model bounds in the sparklines is not desirable.

Comment on lines +150 to +153
comparisonEnabled: toBooleanRt,
comparisonEnabled: comparisonEnabledRt,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think we can just leave this unchanged. We don't need an intermediate type for toBooleanRt

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Removed here 025d4ea

value: TimeRangeComparisonEnum.ExpectedBounds,
text: disabled
? i18n.translate('xpack.apm.comparison.mlExpectedBoundsDisabledText', {
defaultMessage: 'Expected bounds (select other environment)',

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We should mention that anomaly detection must be enabled for the environment:

Suggested change
defaultMessage: 'Expected bounds (select other environment)',
defaultMessage: 'Expected bounds (anomaly detection must be enabled for env)',

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@sqren Thanks. Updated with the new text here... I capitalized Anomaly so it looks more like this now: 1d889d0

Screen Shot 2022-05-24 at 16 25 59

@sorenlouv sorenlouv left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

lgtm. Thanks for all the work @qn895 . The designers and pm's might have some polish comment but I'm okay with doing that during FF.

@kibana-ci

Copy link
Copy Markdown

💛 Build succeeded, but was flaky

Failed CI Steps

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
apm 1207 1208 +1

Async chunks

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

id before after diff
apm 2.9MB 2.9MB +1.5KB

History

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

cc @qn895

@qn895

qn895 commented May 24, 2022

Copy link
Copy Markdown
Member Author

Merging this PR as the one failed test for the latest build doesn't seem to be related to changes in this PR. A big thank you to the APM team for all your help 🙏

@qn895
qn895 merged commit c1d0ec5 into elastic:main May 24, 2022
@kibanamachine kibanamachine added the backport:skip This PR does not require backporting label May 24, 2022
qn895 added a commit to qn895/kibana that referenced this pull request Jun 7, 2022
elastic#132456)

* [ML] Add bounds options

* [ML] Renable anomalyChartTimeseries boundaries

* [ML] Make it into string

* [ML] Make it into string

* Match colors

* [ML] Add comparisonEnabledRt

* [ML] Fix types, tests

* [ML] Revert json bucket span change

* [ML] Add bounds options

* [ML] Renable anomalyChartTimeseries boundaries

* [ML] Make it into string

* [ML] Make it into string

* Match colors

* [ML] Add comparisonEnabledRt

* [ML] Fix types, tests

* [ML] Revert json bucket span change

* Refactor to use offset with TimeRangeComparisonEnum.ExpectedBounds

* Change comparisonColor to be part of anomalySeries

* Fix i18n

* Add Comparison text to replace 'Previous period'

* Fix expected bounds legend default to first

* Hide values that are N/A in the tooltips

* Fix i18n, color, and null values in tooltips

* Refactor to use preferredEnvironment

* Don't disable expected bounds by default

* Match color of expected bounds with time comparison color

* Fix tests

* Use bucket_span as minBucketSize for anomaly results

* Fix previousPeriodColor undefined for latency chart

* Remove 'Comparison:' in legend

* Change anomalyTimeseriesColor to use currentPeriod to match stuff

* Fix type error

* Fix lower model bounds

* Add comments

* Remove fit

* Remove comparisonEnabledRt

* Change text

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
(cherry picked from commit c1d0ec5)
@sorenlouv

Copy link
Copy Markdown
Contributor

💚 All backports created successfully

Status Branch Result
✅ 8.3

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

@sorenlouv

Copy link
Copy Markdown
Contributor

💚 All backports created successfully

Status Branch Result
✅ 8.3

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

@peteharverson peteharverson added release_note:feature Makes this part of the condensed release notes and removed release_note:enhancement labels Jun 8, 2022
sorenlouv pushed a commit that referenced this pull request Jun 10, 2022
…ontrols (#132456) | [APM] Fix ML expected bounds missing data in chart, option showing when not neccessary (#132975) (#133826)

* [APM] Add ML expected model bounds as an option to Comparison controls (#132456)

* [ML] Add bounds options

* [ML] Renable anomalyChartTimeseries boundaries

* [ML] Make it into string

* [ML] Make it into string

* Match colors

* [ML] Add comparisonEnabledRt

* [ML] Fix types, tests

* [ML] Revert json bucket span change

* [ML] Add bounds options

* [ML] Renable anomalyChartTimeseries boundaries

* [ML] Make it into string

* [ML] Make it into string

* Match colors

* [ML] Add comparisonEnabledRt

* [ML] Fix types, tests

* [ML] Revert json bucket span change

* Refactor to use offset with TimeRangeComparisonEnum.ExpectedBounds

* Change comparisonColor to be part of anomalySeries

* Fix i18n

* Add Comparison text to replace 'Previous period'

* Fix expected bounds legend default to first

* Hide values that are N/A in the tooltips

* Fix i18n, color, and null values in tooltips

* Refactor to use preferredEnvironment

* Don't disable expected bounds by default

* Match color of expected bounds with time comparison color

* Fix tests

* Use bucket_span as minBucketSize for anomaly results

* Fix previousPeriodColor undefined for latency chart

* Remove 'Comparison:' in legend

* Change anomalyTimeseriesColor to use currentPeriod to match stuff

* Fix type error

* Fix lower model bounds

* Add comments

* Remove fit

* Remove comparisonEnabledRt

* Change text

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
(cherry picked from commit c1d0ec5)

* [APM] Fix ML expected bounds missing data in chart, option showing when not neccessary (#132975)

* Only show expected bounds option in Overview/Transactions subpage of Services

* Bucket span

* Fix bucket span didn't show up in chart

* Change fixed interval to 60s, add elastic-charts ref

* ui settings remembering

* Address comments

* Address comments

* Fix linting

* Move data point down instead of extending range

* Change to last, add test

* Fix to use xValuesExpectedBounds

* Revert change to to add extra point as es ml already handled it

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
(cherry picked from commit 017c8e1)

Co-authored-by: Quynh Nguyen <43350163+qn895@users.noreply.github.com>
Co-authored-by: Dario Gieselaar <dario.gieselaar@elastic.co>
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
@tylersmalley tylersmalley added ci:cloud-deploy Create or update a Cloud deployment and removed ci:deploy-cloud labels Aug 17, 2022
@qn895
qn895 deleted the apm-comparison-ml-expected-bounds branch September 21, 2022 16:33
patrykkopycinski pushed a commit to patrykkopycinski/kibana that referenced this pull request May 6, 2026
elastic#132456)

* [ML] Add bounds options

* [ML] Renable anomalyChartTimeseries boundaries

* [ML] Make it into string

* [ML] Make it into string

* Match colors

* [ML] Add comparisonEnabledRt

* [ML] Fix types, tests

* [ML] Revert json bucket span change

* [ML] Add bounds options

* [ML] Renable anomalyChartTimeseries boundaries

* [ML] Make it into string

* [ML] Make it into string

* Match colors

* [ML] Add comparisonEnabledRt

* [ML] Fix types, tests

* [ML] Revert json bucket span change

* Refactor to use offset with TimeRangeComparisonEnum.ExpectedBounds

* Change comparisonColor to be part of anomalySeries

* Fix i18n

* Add Comparison text to replace 'Previous period'

* Fix expected bounds legend default to first

* Hide values that are N/A in the tooltips

* Fix i18n, color, and null values in tooltips

* Refactor to use preferredEnvironment

* Don't disable expected bounds by default

* Match color of expected bounds with time comparison color

* Fix tests

* Use bucket_span as minBucketSize for anomaly results

* Fix previousPeriodColor undefined for latency chart

* Remove 'Comparison:' in legend

* Change anomalyTimeseriesColor to use currentPeriod to match stuff

* Fix type error

* Fix lower model bounds

* Add comments

* Remove fit

* Remove comparisonEnabledRt

* Change text

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

backport:skip This PR does not require backporting ci:cloud-deploy Create or update a Cloud deployment :ml release_note:feature Makes this part of the condensed release notes Team:APM - DEPRECATED Use Team:obs-ux-infra_services. v8.3.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants