-
Notifications
You must be signed in to change notification settings - Fork 14.2k
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
refactor: remove slice level label_colors from dashboard init load #10603
refactor: remove slice level label_colors from dashboard init load #10603
Conversation
I think that chart-level colors were a mistake and that we should revisit this. @nytai got tangled into this in the past and in some cases really makes the chart payload gigantic for no super good reason. I think Kim's intent originally was to preserve the dashboard-assigned colors when exploring the chart, but it really bloats the chart's properties. Plus it doesn't really play well with the many-to-many aspect of charts/dashboards, what if the chart is in two dashboards using different color schemes? Even if we wanted to preserve that context, we may want for the chart to only have a reference to the dashboard it's associated with (in that particular context), and use the metadata / color scheme from that dashboard. |
yes, i agree this label_colors props is inappropriately populated into slice. |
If the intention was to keep the same colors when going from the dashboard to explore, I think we should pass the context to explore of which dashboard the user came from, and explore can retrieve whatever dashboard metadata (ie colors) that can affect the context of the chart itself. |
I want to use this PR as a short term solution, to see how big impact those redundant label_colors in slices' form_data to dashboard performance (mostly for large dashboard used in airbnb). If the impact is big, we should do some refactoring for label_colors logic (long term solution):
for both long term and short term solution, dashboard should not carry slice level color_labels. |
ping @mistercrunch @etr2460 |
Sorry, one clarification i'm not 100% sure of: Does this change affect the current user experience in any way? If a dashboard doesn't have colors defined, do we fall back to slice colors which will now be removed? I'd say, if this could change the user experience, then it might be safer to put this in a feature flag. If not, then i'm good to stamp this as an awesome optimization |
0d5e03b
to
8367da4
Compare
if dashboard don't have label_colors setting, after this PR, the label color will be assigned randomly, because slice-level label_color is not carried by dashboard. So I wrap this change into a feature flag, by default is not enable it. This is a short term solution. if we see perf impact for large dashboard, should go with a long term solution. |
Codecov Report
@@ Coverage Diff @@
## master #10603 +/- ##
==========================================
- Coverage 64.06% 60.66% -3.40%
==========================================
Files 771 418 -353
Lines 36391 13650 -22741
Branches 3429 3482 +53
==========================================
- Hits 23314 8281 -15033
+ Misses 12964 5180 -7784
- Partials 113 189 +76
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
one comment, otherwise lgtm!
superset/config.py
Outdated
@@ -304,6 +304,7 @@ def _try_json_readsha( # pylint: disable=unused-argument | |||
# Exposes API endpoint to compute thumbnails | |||
"THUMBNAILS": False, | |||
"REDUCE_DASHBOARD_BOOTSTRAP_PAYLOAD": True, | |||
"REDUCE_SLICE_LEVEL_LABEL_COLORS": False, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
naming nit, REMOVE
instead of REDUCE
probably
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks. fixed!
8367da4
to
a696a71
Compare
* master: (43 commits) feat: Getting fancier with Storybook (apache#10647) fix: dedup groupby in viz.py while preserving order (apache#10633) feat: bump superset-ui for certified tag (apache#10650) feat: setup react page with submenu for datasources listview (apache#10642) feat: add certification to metrics (apache#10630) feat(viz-plugins): add date formatting to pivot-table (apache#10637) fix: controls scroll issue (apache#10644) feat: Allow tests files in /src (plus Label component tests) (apache#10634) fix: remove duplicated params and cache_timeout from list_columns; add viz_type to list_columns (apache#10643) chore: splitting button stories into separate stories (apache#10631) refactor: remove slice level label_colors from dashboard init load (apache#10603) feat: card view bulk select (apache#10607) style: Label styling/storybook touchups (apache#10627) fix: removing unsupported modal sizes (apache#10625) feat(datasource): remove deleted columns and update column type on metadata refresh (apache#10619) improve documentation for country maps (apache#10621) chore: npm audit fix as of 2020-08-15 (apache#10613) feat: dataset REST API for distinct values (apache#10595) chore: bump react-redux to 5.1.2, whittling console noise (apache#10602) fixing console error about bad html attribute (apache#10604) ... # Conflicts: # superset-frontend/src/explore/components/ExploreViewContainer.jsx # superset-frontend/src/views/App.tsx # superset/config.py
SUMMARY
When dashboard is loaded, it loaded bootstrap data for render dashboard. it includes: datasources, slice metadata, and dashboard metadata.
When dashboard has set color_scheme, its metadata will have
color_labels
section and set color for each label in the dashboard. This attribute will overwrite slice level color_label in its form_data. So when used in dashboard, slice's own color_label has no use. But this section could be pretty big and repeated by all the slices in the dashboard, which make the dashboard initial bootstrap data size very big.This PR is to remove slice level color_label attribute (in its form_data) in the dashboard bootstrap data.
TEST PLAN
CI and manually load some dashboards.
@etr2460