slice_id not being logged correctly.
Slice_id has an inconsistent value. Very often 0. THis field shows up in another JSON object called form_data.
@john-bodley please help me embellish this issue with whatever I left out. @mistercrunch
Expected results
The slice_id id correctly displayed.
Actual results
0 is howen
How to reproduce?
Go to a slice and check the logs. the slice_id will not be logged.
@mistercrunch we discovered that on a number of occasions the slice_id column in the logs table was 0 whilst viewing slices. We speculate it's non-zero when someone saves a slice or adds it to a new or existing dashboard.
I'm not sure when this regression occurred, i.e., why the slice_id isn't defined in either the request.form, request.args, or kwargs per this logic, but looking at the logs it seems to be logged in the form_data key of request.args, i.e.,
{"form_data": "{\"datasource\":\"219__druid\",\"viz_type\":\"line\",\"slice_id\":9797}"}
We hypothesized that the fix would be,
try:
slice_id = int(d.get('slice_id') or json.loads(d.get('form_data')).get('slice_id')))
except Exception:
slice_id = 0
Which version is this?