Add indicator when product analytics panels are loading slow
requested to merge 420325-update-loading-icon-for-visualizations-when-loading-is-taking-awhile into master
What does this MR do and why?
Sometimes a CubeJS query can take a long time to execute. In this scenario, the CubeJS client receives a continue wait
response from the server to indicate that the query is still running.
In this situation, we now show an additional loading state on the dashboard panel to give the user some feedback that things are still running.
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Screenshots or screen recordings
Before | After |
---|---|
![]() |
![]() |
Screen recording (with faked / hardcoded timings!)
How to set up and validate locally
- Follow these instructions to setup Product Analytics in GDK.
- Onboard
Product Analytics
by setting up the feature at Project > Analytics > Analytics dashboards. - Generate some events for this project so your dashboards have data.
- View a dashboard, and try trigger the slow loading / "continue wait" scenario by:
mocking the Cube response
In Chrome browser:
- Open chrome devtools
- find one of the Cube network requests,
/load
- right click on it, click
override content
- paste in the continue wait response:
{"error":"Continue wait"}
- refresh the dashboard, every response will now be
continue wait
-
note: this might slow down your PC, as the CubeJS client will start spamming out new requests in response to each continue-wait, basically causing an infinite loop. I suggest closing the tab when you're not actively looking at it
😅 - remember to clean up the override when you're done!
or
Causing the wait for realsies
I had trouble reproducing this continue wait
response consistently in my local dev env, but managed to get it occasionally by:
- seeded my local clickhouse with ~8 million events for this project
- reduced available memory for cube
- open
analytics-devkit/docker-compose.yml
- add
mem_limit: 128m
to thecube
section - I tried lowering it from 128m but cube was then frequently crashing, not sure what the sweet-spot minimum is...
- open
- now run queries that span larger timeframes
- I was seeing
continue wait
maybe 1 in 10 times I loaded the dashboard
Related to #420325 (closed)
Edited by Elwyn Benson