Skip to content

[Lens] Switch to unified metric renderer#126019

Merged
VladLasitsa merged 15 commits intoelastic:mainfrom
VladLasitsa:switch_lens_metric_to_unified_metric_renderer
Mar 9, 2022
Merged

[Lens] Switch to unified metric renderer#126019
VladLasitsa merged 15 commits intoelastic:mainfrom
VladLasitsa:switch_lens_metric_to_unified_metric_renderer

Conversation

@VladLasitsa
Copy link
Copy Markdown
Contributor

Closes: #123797

Summary

  • Removed old implementation of metric in Lens
  • Updated toExpression function so that build correct metricVis expression.

@VladLasitsa
Copy link
Copy Markdown
Contributor Author

@elasticmachine merge upstream

@VladLasitsa
Copy link
Copy Markdown
Contributor Author

@elasticmachine merge upstream

@kibanamachine
Copy link
Copy Markdown
Contributor

expected head sha didn’t match current head ref.

@VladLasitsa VladLasitsa self-assigned this Feb 28, 2022
@VladLasitsa VladLasitsa added backport:skip This PR does not require backporting Feature:Lens release_note:skip Skip the PR/issue when compiling release notes Team:Visualizations Team label for Lens, elastic-charts, Graph, legacy editors (TSVB, Visualize, Timelion) t// v8.2.0 labels Feb 28, 2022
@VladLasitsa
Copy link
Copy Markdown
Contributor Author

@elasticmachine merge upstream

@VladLasitsa VladLasitsa marked this pull request as ready for review March 1, 2022 12:02
@VladLasitsa VladLasitsa requested review from a team as code owners March 1, 2022 12:02
@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/kibana-vis-editors @elastic/kibana-vis-editors-external (Team:VisEditors)

@VladLasitsa VladLasitsa requested a review from alexwizp March 1, 2022 14:04
Copy link
Copy Markdown
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.

Most of this works perfectly fine, there's just one thing I noticed about the font sizes (see comment)

reverse: false,
};

const fontSizes: Record<string, { size: number; sizeUnit: string }> = {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It seems like this mapping is pretty different than the old one: https://github.com/elastic/kibana/pull/126019/files#diff-2c977ca1fa0b45f15d61f5c8722ef7209c1e01f521a69761454599b074203778L37-L85

I don't have a super strong opinion on this but especially the small sizes feel too large with this new setting - it's very useful to create small metrics, e.g. for solutions (left is new, right is old).
Screenshot 2022-03-01 at 18 17 26

I would suggest going with the old mapping

Copy link
Copy Markdown
Contributor Author

@VladLasitsa VladLasitsa Mar 2, 2022

Choose a reason for hiding this comment

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

@flash1293 I tried to find a general approach so that the ratio of the size of the metric to the size of the labels is always the same, because before each metric size was chosen according to different rules depending on the size of the label. You can see it here x-pack/plugins/lens/public/metric_visualization/expression.scss

If you would like I can back to that solution and update mapping

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I promised to have a look here and I just wanted to confirm that Joe's solution will be ok from my point of view!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@flash1293 I updated font size mapping

@VladLasitsa
Copy link
Copy Markdown
Contributor Author

@elasticmachine merge upstream

…b.com:VladLasitsa/kibana into switch_lens_metric_to_unified_metric_renderer
@VladLasitsa VladLasitsa requested a review from flash1293 March 3, 2022 14:51
Copy link
Copy Markdown
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.

Small nit, approving to not holding back merging this

@VladLasitsa VladLasitsa requested a review from stratoula March 4, 2022 07:40
@VladLasitsa
Copy link
Copy Markdown
Contributor Author

@elasticmachine merge upstream

@kibana-ci
Copy link
Copy Markdown

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
lens 750 740 -10

Async chunks

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

id before after diff
expressionMetricVis 11.0KB 11.0KB +64.0B
lens 1.1MB 1.1MB -7.8KB
total -7.7KB

Public APIs missing exports

Total count of every type that is part of your API that should be exported but is not. This will cause broken links in the API documentation system. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats exports for more detailed information.

id before after diff
lens 44 43 -1

Page load bundle

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

id before after diff
expressionMetricVis 8.8KB 8.9KB +26.0B
lens 44.4KB 42.6KB -1.8KB
total -1.7KB

History

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

cc @VladLasitsa

@VladLasitsa VladLasitsa merged commit 9f880f2 into elastic:main Mar 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:skip This PR does not require backporting Feature:Lens release_note:skip Skip the PR/issue when compiling release notes Team:Visualizations Team label for Lens, elastic-charts, Graph, legacy editors (TSVB, Visualize, Timelion) t// v8.2.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Lens] Switch to unified metric renderer

8 participants