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

Cutover aggs to the new platform #59605

Merged
merged 15 commits into from
Mar 13, 2020
Merged

Conversation

lukeelmers
Copy link
Member

@lukeelmers lukeelmers commented Mar 7, 2020

Summary

Moves agg_types into the new platform under the data plugin's search service. Once this PR is merged, it should unblock anybody waiting on the rest of the search service to move to the new platform.

Some specific items moved include:

  • agg_types
  • esaggs
  • tabify
  • registration of range action and click action

At this point there is nothing left in src/legacy/core_plugins/data that anybody should need to rely on... anything there is getting left behind for BWC and can be completely deleted when downstream apps complete migration.

For reviewers

If you got pinged for a codeowners review, don't be intimidated by the size of this PR 😬

Most of the significant changes here affect code owned by app arch, but since nearly all of the code has been removed from src/legacy/core_plugins/data at this point, imports needed to be updated across the project. In most cases you should only have a few changed lines of code to review.

For those reviewing large portions of the PR, I recommend going commit-by-commit instead of attempting to peruse the whole thing. I've tried to keep a coherent commit history so it should make things somewhat easier to follow.

For QA

This PR should introduce no functional changes to Kibana; it is 100% internal refactoring as we migrate our search aggregation infrastructure to the new platform.

Additional info

  • Now that docs extractor has been added to data plugin, a ton of markdown files were created
  • Updated MIGRATION.md to reflect changes
  • Exports from ui/agg_types were preserved for BWC and to minimize the changes that need to go into this (already large) PR.
  • Structure of the contracts that were already in place in core_plugins/data has been preserved
  • Date-related interval utils have been grouped together under data/common. This includes parseEsInterval, dateHistogramInverval, isValidEsInterval, etc.
  • Updates were made to ui/new_platform to ensure functionality that was necessary for the legacy platform still works without the legacy data plugin

Dev docs

I am skipping docs on this PR, as the documentation is being added to the 7.7 ui/public cleanup documentation issue.

@lukeelmers lukeelmers added release_note:plugin_api_changes Contains a Plugin API changes section for the breaking plugin API changes section. v8.0.0 Team:AppArch Feature:NP Migration v7.7.0 labels Mar 7, 2020
@lukeelmers lukeelmers self-assigned this Mar 7, 2020
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-app-arch (Team:AppArch)

@lukeelmers lukeelmers force-pushed the aggs/cutover branch 2 times, most recently from 59d7a0d to 79495f9 Compare March 9, 2020 22:24
@lukeelmers lukeelmers changed the title WIP: Cutover aggs to the new platform Cutover aggs to the new platform Mar 10, 2020
*/
function noWhiteSpace(html: string) {
const TAGS_WITH_WS = />\s+</g;
return html.replace(TAGS_WITH_WS, '><');
Copy link
Member Author

Choose a reason for hiding this comment

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

This is a one-line function so I inlined it here rather than importing from legacy kibana plugin as we had done previously.

export interface DataSetup {
search: SearchSetup;
}
export interface DataSetup {} // eslint-disable-line @typescript-eslint/no-empty-interface
Copy link
Member Author

Choose a reason for hiding this comment

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

Kept these empty interfaces in place because there were a few areas in Kibana still using them. (trying to keep things as small as possible).

setInjectedMetadata(core.injectedMetadata);

export class DataPlugin implements Plugin<DataSetup, DataStart> {
public setup(core: CoreSetup) {
// This is to be deprecated once we switch to the new search service fully
addSearchStrategy(defaultSearchStrategy);
Copy link
Member Author

Choose a reason for hiding this comment

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

@lizozom said this will be going away shortly

export * from './index_patterns';
export * from './es_query';
export * from './utils';
Copy link
Member Author

Choose a reason for hiding this comment

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

Removed this export because now the only thing in utils is internal to other items in the common directory.

@@ -3,6 +3,9 @@
"version": "kibana",
"server": true,
"ui": true,
"requiredPlugins": ["uiActions"],
"requiredPlugins": [
"expressions",
Copy link
Member Author

Choose a reason for hiding this comment

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

expressions is now required to register esaggs function

Comment on lines +150 to +152
actions: {
createFiltersFromEvent,
},
Copy link
Member Author

Choose a reason for hiding this comment

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

createFiltersFromEvent is technically stateful as it relies on index patterns behind the scenes. Open to suggestions on where this should live, but in its current form it cannot be exported statically @ppisljar

geoTileBucketAgg,
],
};
export function getAggTypes(deps: { uiSettings: IUiSettingsClient }) {
Copy link
Member Author

Choose a reason for hiding this comment

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

Now that this has been wrapped with a provider pattern, we can (as a follow up step) get rid of the getters/setters that are currently being used to retrieve stateful services in each agg type, and instead explicitly pass those deps down.

Copy link
Member

Choose a reason for hiding this comment

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

might make sense to pass down something that can be same on client and server (like getConfig function)

@@ -41,11 +40,10 @@ import {
export function mockDataServices() {
Copy link
Member Author

Choose a reason for hiding this comment

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

This still lives as a test helper inside search.aggs, but might be more generically useful elsewhere in the data plugin. Perhaps we consider eventually moving it up to a different directory

search: newSearchMock,
__LEGACY: {
esClient: {
search: searchMock,
msearch: msearchMock,
},
},
},
} as unknown) as jest.Mocked<ISearchStart>,
Copy link
Member Author

Choose a reason for hiding this comment

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

Changed this to casting because there was a circular dependency going back to require the search.aggs mocks, and it felt unnecessary to duplicate the entire search service contract here

@@ -18,18 +18,19 @@
*/

export {
calculateObjectHash,
Copy link
Member Author

Choose a reason for hiding this comment

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

calculateObjectHash wasn't exported at the top level so I added it here, and alphabetized

@lukeelmers

This comment has been minimized.

@elasticmachine

This comment has been minimized.

@lukeelmers lukeelmers added the Feature:Aggregations Aggregation infrastructure (AggConfig, esaggs, ...) label Mar 10, 2020
@lukeelmers lukeelmers added release_note:skip Skip the PR/issue when compiling release notes review and removed release_note:plugin_api_changes Contains a Plugin API changes section for the breaking plugin API changes section. labels Mar 10, 2020
@lukeelmers lukeelmers marked this pull request as ready for review March 11, 2020 03:16
@lukeelmers lukeelmers requested a review from a team March 11, 2020 03:16
@lukeelmers lukeelmers requested review from a team as code owners March 11, 2020 03:16
@kibanamachine
Copy link
Contributor

💚 Build Succeeded

History

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

Copy link
Contributor

@joshdover joshdover left a comment

Choose a reason for hiding this comment

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

Migration guide changes LGTM. Thanks for making the plugins. prefix more clear 😄

Copy link
Member

@ppisljar ppisljar left a comment

Choose a reason for hiding this comment

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

code LGTM

Copy link
Contributor

@sulemanof sulemanof left a comment

Choose a reason for hiding this comment

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

LGTM, mostly checked the default editor changes, great work!

@flash1293
Copy link
Contributor

I will review this PR today.

@flash1293 flash1293 mentioned this pull request Mar 13, 2020
69 tasks
Copy link
Contributor

@flash1293 flash1293 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 couldn't find any problems, LGTM 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Aggregations Aggregation infrastructure (AggConfig, esaggs, ...) Feature:NP Migration release_note:skip Skip the PR/issue when compiling release notes review v7.7.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants