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

Use renderComplete handler in maps embeddable #144421

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

lizozom
Copy link
Contributor

@lizozom lizozom commented Nov 2, 2022

Summary

Use renderComplete handler in maps embeddable to correctly await maps loading.

Similar to #144243

Checklist

Delete any items that are not applicable to this PR.

Risk Matrix

Delete this section if it is not applicable to this PR.

Before closing this PR, invite QA, stakeholders, and other developers to identify risks that should be tested prior to the change/feature release.

When forming the risk matrix, consider some of the following examples and how they may potentially impact the change:

Risk Probability Severity Mitigation/Notes
Multiple Spaces—unexpected behavior in non-default Kibana Space. Low High Integration tests will verify that all features are still supported in non-default Kibana Space and when user switches between spaces.
Multiple nodes—Elasticsearch polling might have race conditions when multiple Kibana nodes are polling for the same tasks. High Low Tasks are idempotent, so executing them multiple times will not result in logical error, but will degrade performance. To test for this case we add plenty of unit tests around this logic and document manual testing procedure.
Code should gracefully handle cases when feature X or plugin Y are disabled. Medium High Unit tests will verify that any feature flag or plugin combination still results in our service operational.
See more potential risk examples

For maintainers

@lizozom lizozom added release_note:skip Skip the PR/issue when compiling release notes v8.6.0 labels Nov 2, 2022
@lizozom lizozom marked this pull request as ready for review November 2, 2022 14:23
@lizozom lizozom requested a review from a team as a code owner November 2, 2022 14:23
@nreese
Copy link
Contributor

nreese commented Nov 2, 2022

@dmlemeshko is the ecommerce dashboard used in x-pack/performance/journeys/ecommerce_dashboard.ts the same as ecommerce sample data dashboard? Because the ecommerce sample data dashboard does have a map when Maps application is running.

Screen Shot 2022-11-02 at 10 01 39 AM

@nreese
Copy link
Contributor

nreese commented Nov 2, 2022

@tsullivan Do components still need to set data-render-complete or is data-render-complete no longer needed when using embeddable.renderComplete?

@nreese
Copy link
Contributor

nreese commented Nov 2, 2022

cc @dokmic Do you have any insight into the #144421 (comment)?

@tsullivan
Copy link
Member

tsullivan commented Nov 2, 2022

@tsullivan Do components still need to set data-render-complete or is data-render-complete no longer needed when using embeddable.renderComplete?

You no longer need to set the data-render-complete attribute yourself. embeddable.renderComplete is a RenderCompleteDispatcher, and handles the setAttribute calls for you, to set the data attributes that are needed for reporting & performance tooling. For more info, check out #74504

@lizozom
Copy link
Contributor Author

lizozom commented Nov 2, 2022

@nreese the map loading was taking much longer than the rest of the visualizations, so we moved them to a standalone test called ecommerce_dashboard_map_only.

And yes, no need to set data-render-complete yourself, but removing it caused several functional tests to fail, so I decided there was not much harm in keeping both for now. Feel free to remove the internal one if you like.

@dmlemeshko
Copy link
Member

dmlemeshko commented Nov 3, 2022

@dmlemeshko is the ecommerce dashboard used in x-pack/performance/journeys/ecommerce_dashboard.ts the same as ecommerce sample data dashboard? Because the ecommerce sample data dashboard does have a map when Maps application is running.

@nreese yes, that is the one. We decided to move map viz away from original ecommerce dashboard in its own journey (single viz on dashboard) and track performance separately.

@kibana-ci
Copy link
Collaborator

💚 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
maps 2.7MB 2.7MB +170.0B
Unknown metric groups

ESLint disabled in files

id before after diff
osquery 1 2 +1

ESLint disabled line counts

id before after diff
enterpriseSearch 19 21 +2
fleet 58 64 +6
osquery 106 111 +5
securitySolution 440 446 +6
total +19

Total ESLint disabled count

id before after diff
enterpriseSearch 20 22 +2
fleet 66 72 +6
osquery 107 113 +6
securitySolution 517 523 +6
total +20

History

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

Copy link
Contributor

@nreese nreese left a comment

Choose a reason for hiding this comment

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

Thanks for putting this PR together. While I agree that MapEmbeddable needs to be updated to use this.renderComplete, I also believe we need to clean up existing uses of data- attributes to avoid confusion and overlapping functionality.

For example, in the screen shot below, these 2 elements now contain duplicated data-* attributes.
Screen Shot 2022-11-03 at 12 00 17 PM

This can be cleaned up by removing setting data- attributes in MapContainer

This PR also introduces different behavior for when data-render-complete is set to true. MapContainer implementation uses a timeout to fire data-render-complete after all layers have loaded to account for rendering time that is not possible to measure with a map. this.renderComplete implementation should include this timeout as well so data-render-complete is not set to true until a set amount of time. The existing 5000 timeout is likely excessive and maybe we can trim this to something smaller like 1000.

Another thing to consider is that MapEmbeddable may exist within other embeddables. One example is legacy tile_map and region_map visualizations. Those visualizations are now implemented as wrappers around MapEmbeddable so you have something like the below

  <VisualizeEmbeddable>
    <MapEmbeddable>
    </MapEmbeddable>
  </VisualizeEmbeddable>

Screen Shot 2022-11-03 at 12 13 03 PM

This problem can be solved by only calling this.renderComplete when this._isSharable is true.

Can you provide some background into why this change is being made? Is map embeddable not functioning properly now? Is the existing behavior of data-render-complete incorrect. I think understanding the why will help answer some implementation questions.

Also, if this is something that is too involved, the Maps team can take over the effort.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release_note:skip Skip the PR/issue when compiling release notes v8.6.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants