Skip to content

Split data and expression plugins#45125

Merged
lizozom merged 16 commits intoelastic:masterfrom
lizozom:newplatform/data-plugin/split-me
Sep 12, 2019
Merged

Split data and expression plugins#45125
lizozom merged 16 commits intoelastic:masterfrom
lizozom:newplatform/data-plugin/split-me

Conversation

@lizozom
Copy link
Contributor

@lizozom lizozom commented Sep 9, 2019

Summary

Split data and expression plugins to avoid circular dependencies.

Checklist

Use strikethroughs to remove checklist items you don't feel are applicable to this PR.

For maintainers

@lizozom lizozom self-assigned this Sep 9, 2019
@lizozom lizozom added release_note:plugin_api_changes Contains a Plugin API changes section for the breaking plugin API changes section. Feature:NP Migration Team:AppArch v7.5.0 v8.0.0 labels Sep 9, 2019
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-app-arch

@lizozom lizozom added the review label Sep 9, 2019
@lizozom lizozom requested a review from ppisljar September 9, 2019 12:58
@elasticmachine
Copy link
Contributor

💔 Build Failed

@lizozom lizozom marked this pull request as ready for review September 9, 2019 14:13
@lizozom lizozom requested review from a team as code owners September 9, 2019 14:13
@lukeelmers
Copy link
Contributor

lukeelmers commented Sep 9, 2019

Sorry, I know I've asked this before, but just to clarify: exactly where was the circular dependency again?

Asking because I still think it makes much more sense to keep expressions as a service in data if there is anything we can do to help it. Of course if there is no other choice and it is unavoidable, we've gotta do what we've gotta do.

@elasticmachine
Copy link
Contributor

💔 Build Failed

Liza K added 3 commits September 9, 2019 18:47
replace __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED with __LEGACY
@elastic elastic deleted a comment from elasticmachine Sep 9, 2019
@lizozom
Copy link
Contributor Author

lizozom commented Sep 9, 2019

@ppisljar actually mentioned this last week on our team sync I think.
He reminded me of this today.

We have a circular dependency between visualizations and data plugins, and we wanted to split those two anyway.

@elasticmachine
Copy link
Contributor

💔 Build Failed

@lukeelmers
Copy link
Contributor

We have a circular dependency between visualizations and data plugins, and we wanted to split those two anyway.

Yeah I knew it was a vis/data thing, I was just looking for what the specific dependency was. Something to do with renderers presumably? It would be nice to write that down so we have a documented reason for this decision for future reference.

The other issues we discussed offline (specifically around difficulties with circular deps in testing) can be mitigated with updated mocks and anyway won't be an issue by the time we get to New Platform -- they will just pose challenges during the migration process.

I'm on board with splitting out expressions if it is our only option... just making confirming that this is, in fact, the case 😉

If there's one piece of the data plugin that would make sense to split out, it would probably be expressions anyway. Though I'd still suggest we put any custom expression functions related to data querying (e.g. esaggs) inside of data and register them to the expressions service from there.

@lukeelmers lukeelmers mentioned this pull request Sep 9, 2019
7 tasks
@elasticmachine
Copy link
Contributor

💔 Build Failed

@lizozom
Copy link
Contributor Author

lizozom commented Sep 10, 2019

@lukeelmers I guess @ppisljar might be able to shed some light on what's exactly creating this dependency.

@lizozom lizozom requested a review from mattkime September 10, 2019 11:04
@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@elastic elastic deleted a comment from elasticmachine Sep 10, 2019
@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@ppisljar
Copy link
Contributor

didn't go thru the code yet, but just to answer the question about circular dependency:

  • currently expressions service includes renderers registry and RenderHandler.
  • renderer handler depends on visualization registry
  • visualizations plugin depends on the data plugin (circular dependency)

there are two approaches we might take to resolve that:

  • move renderers registry and renderer handler to visulizations plugin. They are not coupled to expressions in any way.
  • split expressions into its own plugin that has dependency on visalizations and data

there is this other thing Liza is mentioning, when you want to query ES using our low level search service you don't really need anything, but you might want to still use indexPatterns.
when you want to query ES using our high level search API you will need using our search service, you will most likely need: Query, Filters, TimeFilter, AggConfigs and IndexPattern .... but you still won't need the expressions. Expressions come on top of all of this, and when you use them you might or might not use anything else from data plugin. From this perspective it makes sense to me for them to be a separate plugin. But it doesn't say it needs to be.

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Copy link
Contributor

@crob611 crob611 left a comment

Choose a reason for hiding this comment

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

Canvas changes look good 👍

@lizozom lizozom requested a review from mattkime September 12, 2019 08:07
Copy link
Contributor

@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, one minor comment

export default function DataExpressionsPlugin(kibana: any) {
const config: Legacy.PluginSpecOptions = {
id: 'expressions',
require: ['elasticsearch'],
Copy link
Contributor

Choose a reason for hiding this comment

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

requires data as well

Copy link
Contributor

Choose a reason for hiding this comment

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

actually, ignore this comment. it shouldn't require data, all the functions that do require data should be registered from data plugin (or another plugin listing data as dependency)

@lizozom lizozom dismissed mattkime’s stale review September 12, 2019 12:57

Feedback addressed

@lizozom lizozom merged commit a45b0a7 into elastic:master Sep 12, 2019
lizozom pushed a commit to lizozom/kibana that referenced this pull request Sep 12, 2019
* split data plugin from expression plugin

* added expressions as dependency to visualizations

* ui/agg import

* expressions start contract
replace __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED with __LEGACY

* Rename contract

* vis deps

* Fix build pipeline mocks

* Added expressions plugin to karma mock

* update imports

* export types from common

* Restore types.ts

* Remove unused expressions plugin server code
wylieconlon pushed a commit that referenced this pull request Sep 12, 2019
* Split data and expression plugins (#45125)

* split data plugin from expression plugin

* added expressions as dependency to visualizations

* ui/agg import

* expressions start contract
replace __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED with __LEGACY

* Rename contract

* vis deps

* Fix build pipeline mocks

* Added expressions plugin to karma mock

* update imports

* export types from common

* Restore types.ts

* Remove unused expressions plugin server code

* fixed failing test
@rayafratkina
Copy link
Contributor

@lizozom can you please add a DevDocs section?

@lizozom lizozom deleted the newplatform/data-plugin/split-me branch November 14, 2019 13:06
@streamich streamich removed the release_note:plugin_api_changes Contains a Plugin API changes section for the breaking plugin API changes section. label Nov 14, 2019
@lizozom lizozom added the release_note:skip Skip the PR/issue when compiling release notes label Nov 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants