-
Notifications
You must be signed in to change notification settings - Fork 14.5k
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
fix(dashboard): 500 error caused by data_for_slices API #16053
Conversation
for column in utils.get_iterable(form_data.get(param) or []) | ||
for param in COLUMN_FORM_DATA_PARAMS | ||
for column_param in COLUMN_FORM_DATA_PARAMS | ||
for column in utils.get_iterable(form_data.get(column_param) or []) |
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.
The order of the for loop is incorrect. Normally it will throw an undefined variable error but since param
was used in other loops above, the code will still run. Just another example of why too many local variables is not a good thing.
if column_name: | ||
columns.append(column_name) | ||
return columns | ||
return [col for col in map(get_column_name_from_metric, metrics) if col] |
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.
Bycatch refactor. No real code logic changes.
a7e5eef
to
fd3b68b
Compare
Codecov Report
@@ Coverage Diff @@
## master #16053 +/- ##
==========================================
- Coverage 76.81% 76.66% -0.15%
==========================================
Files 995 995
Lines 52869 52864 -5
Branches 6712 6712
==========================================
- Hits 40610 40528 -82
- Misses 12033 12110 +77
Partials 226 226
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.
LGTM!
Thanks for quick fix!
fd3b68b
to
f0fd52c
Compare
(cherry picked from commit 490890d)
(cherry picked from commit 490890d)
(cherry picked from commit 490890d)
(cherry picked from commit d51a2b5)
SUMMARY
Fix a 500 error on the
/dashboard/<dashboardId>/datasets
API caused by an incorrect nested list comprehension introduced by #15993 .Updated the test case to cover this case.
In dashboards where a slice has the
y
metric set (e.g. a NVD3 timeseries chart), the/datasets
API will return 500. However, most of the time if will not break the dashboard, since this API is almost only used in FilterBox and filter indicators.BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
N/A
TESTING INSTRUCTIONS
ADDITIONAL INFORMATION