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] Removes duplicated service code used in Single Metric Viewer #178566

Merged

Conversation

alvarezmelissa87
Copy link
Contributor

@alvarezmelissa87 alvarezmelissa87 commented Mar 12, 2024

Summary

Related meta issue: #176651

This PR removes duplicates created in the initial PR for adding SMV as an embeddable in dashboards:

  • ml/public/application/services/forecast_service_provider.ts replaces ml/public/application/services/forecast_service.js

  • ml/public/application/timeseriesexplorer/timeseriesexplorer_utils/time_series_search_service.ts replaces ml/public/application/timeseriesexplorer/timeseries_search_service.ts

  • removes ml/public/application/timeseriesexplorer/timeseriesexplorer_utils/timeseriesexplorer_utils.js

Checklist

Delete any items that are not applicable to this PR.

@alvarezmelissa87 alvarezmelissa87 added :ml Feature:Anomaly Detection ML anomaly detection release_note:skip Skip the PR/issue when compiling release notes v8.14.0 labels Mar 12, 2024
@alvarezmelissa87 alvarezmelissa87 self-assigned this Mar 12, 2024
Copy link
Contributor

@walterra walterra left a comment

Choose a reason for hiding this comment

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

Overall nice reduction of duplicated code! 🥳 Just added some naming suggestions and one about withKibana/context. To play it safe, maybe let's do a PR first with functional tests of the Single Metric Viewer embedding and then get this one in afterwards?

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.

Overall looks good. Manual testing of the chart inside ML and Dashboard as an embeddable all working as expected.

@alvarezmelissa87
Copy link
Contributor Author

Overall nice reduction of duplicated code! 🥳 Just added some naming suggestions and one about withKibana/context. To play it safe, maybe let's do a PR first with functional tests of the Single Metric Viewer embedding and then get this one in afterwards?

Thanks for taking a look @walterra - added functional tests here: #178768

@alvarezmelissa87
Copy link
Contributor Author

Updated with suggested changes. Also removed timeseriesexplorer_utils.js and removed the need for the final function in it createTimeSeriesJobData.

Ready for another test/look when you get a chance cc @peteharverson, @walterra
I will hold off on merging until the functional test PR is merged and this PR is updated with latest from main. 👍

@alvarezmelissa87
Copy link
Contributor Author

@elasticmachine merge upstream

@alvarezmelissa87 alvarezmelissa87 marked this pull request as ready for review March 18, 2024 19:15
@alvarezmelissa87 alvarezmelissa87 requested a review from a team as a code owner March 18, 2024 19:15
@elasticmachine
Copy link
Contributor

Pinging @elastic/ml-ui (:ml)

Copy link
Contributor

@walterra walterra left a comment

Choose a reason for hiding this comment

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

Latest changes LGTM! 🚀

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.

Latest changes LGTM

Copy link
Member

@jgowdyelastic jgowdyelastic left a comment

Choose a reason for hiding this comment

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

Added some small comments, but on the whole LGTM.

@@ -546,4 +557,4 @@ export class ForecastingModalUI extends Component {
}
}

export const ForecastingModal = withKibana(ForecastingModalUI);
export const ForecastingModal = ForecastingModalUI;
Copy link
Member

Choose a reason for hiding this comment

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

ForecastingModalUI isn't needed anymore now. The class can just called ForecastingModal

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated in 70a4278

@@ -21,12 +21,12 @@ import {

import { i18n } from '@kbn/i18n';
import { FormattedMessage } from '@kbn/i18n-react';
import { withKibana } from '@kbn/kibana-react-plugin/public';
import { withKibana, context } from '@kbn/kibana-react-plugin/public';
Copy link
Member

Choose a reason for hiding this comment

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

Looks like the same can be done here, we can remove withKibana as we now use context.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated in 70a4278

expression: string;
}

export interface ChartDataPoint {
Copy link
Member

Choose a reason for hiding this comment

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

Nit, these don't need to be exported anymore as they are only used inside this file.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated in 70a4278

@alvarezmelissa87
Copy link
Contributor Author

@elasticmachine merge upstream

@alvarezmelissa87
Copy link
Contributor Author

/ci

@alvarezmelissa87
Copy link
Contributor Author

@elasticmachine merge upstream

@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
ml 1950 1946 -4

Async chunks

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

id before after diff
ml 3.7MB 3.7MB -8.7KB

History

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

cc @alvarezmelissa87

@walterra walterra merged commit 8c85463 into elastic:main Mar 20, 2024
16 checks passed
@kibanamachine kibanamachine added the backport:skip This commit does not require backporting label Mar 20, 2024
@alvarezmelissa87 alvarezmelissa87 deleted the ml-smv-remove-service-duplicates branch March 20, 2024 14:37
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:Anomaly Detection ML anomaly detection :ml release_note:skip Skip the PR/issue when compiling release notes v8.14.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants