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] Combines ui/time_buckets into MlTimeBuckets #46227

Merged
merged 3 commits into from
Sep 25, 2019

Conversation

peteharverson
Copy link
Contributor

@peteharverson peteharverson commented Sep 20, 2019

Summary

ML was making heavy use of the Kibana TimeBuckets object (ui/time_buckets), in calculating the aggregation interval for time series charts. This was both through direct use, and with the MlTimeBuckets object which inherited from TimeBuckets but with added functionality for setting the number of bars to target in the chart.

As discussed in #44249, in preparation for the new platform Kibana TimeBuckets will become part of the data plugin, and won't be exposed as an API. This PR therefore copies into ml_time_buckets.js the parts of TimeBuckets from ui/time_buckets which were being inherited, and switches all usage in the ML plugin to MlTimeBuckets.

The code has been copied in unchanged, apart from dropping the cache object which was used in the Kibana TimeBuckets.

Checklist

Fixes #44249

@elasticmachine
Copy link
Contributor

Pinging @elastic/ml-ui

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

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.

Code looks good for this PR. Just a question about copying over the code: Does the original time buckets code maybe have more test coverage we could also bring over?

@peteharverson
Copy link
Contributor Author

@walterra there wasn't any test coverage for the original time_buckets.js code, and we already have good coverage for ml_time_buckets.js in /ml/public/util/__tests__/ml_time_buckets.js. However I notice we don't have any coverage for ml_calc_auto_interval.js, which is used in place of the Kibana calc_auto_interval, so I will look at adding some coverage for that.

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.

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.

tested and LGTM
As the original kibana TimeBuckets is being removed, is it worth just renaming this just to TimeBuckets rather than MlTimeBuckets?

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@jgowdyelastic
Copy link
Member

Still LGTM

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@peteharverson peteharverson merged commit 0fae8ce into elastic:master Sep 25, 2019
@peteharverson peteharverson deleted the ml-time-buckets branch September 25, 2019 16:00
peteharverson added a commit to peteharverson/kibana that referenced this pull request Sep 25, 2019
* [ML] Combines ui/time_buckets into MlTimeBuckets

* [ML] Add unit tests for ml calc_auto_interval

* [ML] Rename MlTimeBuckets to TimeBuckets
peteharverson added a commit that referenced this pull request Sep 25, 2019
* [ML] Combines ui/time_buckets into MlTimeBuckets

* [ML] Add unit tests for ml calc_auto_interval

* [ML] Rename MlTimeBuckets to TimeBuckets
@peteharverson peteharverson mentioned this pull request Oct 30, 2019
78 tasks
walterra added a commit that referenced this pull request Mar 20, 2024
#178756)

## Summary

Follow up to #46227.

Consolidates multiple copies of `time_buckets.js` into
`@kbn/ml-time-buckets`. The scope of this PR is just to consolidate the
files. In follow ups we still need to: Refactor JS to TS and get rid of
the code that uses this using "dependency cache" in the `ml` plugin.

### Checklist

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [x] This was checked for breaking API changes and was [labeled
appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[ML] Copy over TimeBuckets into ML code
4 participants