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

[Lens] Register all expression functions to the server #107836

Merged
merged 2 commits into from
Aug 11, 2021

Conversation

alexwizp
Copy link
Contributor

@alexwizp alexwizp commented Aug 6, 2021

Part of: #97134

Summary

What was done in that PR:

  1. List of functions which were registered to the server:
    • lens_time_scale
    • lens_counter_rate
    • lens_rename_columns
    • lens_format_column
    • lens_datatable_column
    • lens_datatable (relies on field formatter service)
    • lens_metric_chart
    • lens_pie
    • lens_xy_legendConfig
    • lens_xy_yConfig
    • lens_xy_tickLabelsConfig
    • lens_xy_gridlinesConfig
    • lens_xy_axisTitlesVisibilityConfig
    • lens_xy_layer
    • lens_xy_chart
  2. removed deprecation usage of data.fieldsFormats service. This service was moved into separate plugin which should be used independently of data plugin.
  3. formatFactory method was refactored to avoid using of the following code:
    const formatFactory = await dependencies.formatFactory;

@alexwizp alexwizp marked this pull request as ready for review August 9, 2021 07:50
@alexwizp alexwizp requested a review from a team August 9, 2021 07:50
@alexwizp alexwizp added this to In progress in Lens via automation Aug 9, 2021
@alexwizp alexwizp added v7.15.0 v8.0.0 Feature:Lens Team:Visualizations Visualization editors, elastic-charts and infrastructure labels Aug 9, 2021
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-app (Team:KibanaApp)

@alexwizp alexwizp added the release_note:skip Skip the PR/issue when compiling release notes label Aug 9, 2021
@alexwizp alexwizp self-assigned this Aug 9, 2021
@dej611
Copy link
Contributor

dej611 commented Aug 9, 2021

Had a first code review of this PR. While 1 and 2 seems ok, the 3rd point is what makes up the most of the file count.
I am not 100% sure about the changes in the formatFactory scope for this PR. Probably it would be better to address it in another PR so we could better discuss about the changes implications? What do you think?

const getStartServices = async (): Promise<LensEmbeddableStartServices> => {
const [coreStart, deps] = await core.getStartServices();
this.initParts(core, data, embeddable, charts, expressions, usageCollection);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just want to clarify is it expected that we execute initParts without await?

@alexwizp
Copy link
Contributor Author

alexwizp commented Aug 9, 2021

the 3rd point is what makes up the most of the file count.

@dej611 This fix allow me to simplify typing, cause now for all cases it's not a promise. Plus in all cases where we execute initParts we already have all needed start services to remove
image
But if you insist we can probably move that into a separate PR. But from my point of view all of this related... Again I'm not insist.

@dej611
Copy link
Contributor

dej611 commented Aug 9, 2021

Maybe I would ask @ppisljar to check as well here.

expressions,
editorFrame,
charts,
}: IndexPatternDatasourceSetupPlugins
) {
editorFrame.registerDatasource(async () => {
const {
Copy link
Member

Choose a reason for hiding this comment

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

registration of functions on the client seems to happen late (after setup lifecycle)

this should be fixed (not necesarry as part of this PR) as we plan to introduce checks in expression service that will prevent this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes you are right, I also wanted to highlight that in my PR, but then decided that it's not related.... In Lens we have some setup methods which executed on start phase =(

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes this is important, but we will take care of it in another PR

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

@VladLasitsa VladLasitsa 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!

@alexwizp
Copy link
Contributor Author

@elasticmachine merge upstream

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Async chunks

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

id before after diff
lens 1.6MB 1.6MB +118.0B

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
lens 29.0KB 29.1KB +133.0B
Unknown metric groups

API count

id before after diff
lens 208 209 +1

API count missing comments

id before after diff
lens 192 193 +1

History

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

cc @alexwizp

Copy link
Contributor

@stratoula stratoula 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, I can't find any regression caused by these changes. I tested it locally in safari. If @mbondyra is also fine, let's merge it

Copy link
Contributor

@mbondyra mbondyra 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 break it. Code LGTM 🆗

@alexwizp alexwizp merged commit 82bec98 into elastic:master Aug 11, 2021
Lens automation moved this from In progress to Done Aug 11, 2021
alexwizp added a commit to alexwizp/kibana that referenced this pull request Aug 11, 2021
Part of:  elastic#97134

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
alexwizp added a commit that referenced this pull request Aug 11, 2021
…8175)

Part of:  #97134

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>

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
Feature:Lens release_note:skip Skip the PR/issue when compiling release notes Team:Visualizations Visualization editors, elastic-charts and infrastructure v7.15.0 v8.0.0
Projects
No open projects
Lens
  
Done
Development

Successfully merging this pull request may close these issues.

None yet

8 participants