superset icon indicating copy to clipboard operation
superset copied to clipboard

slice_id not being logged correctly.

Open timifasubaa opened this issue 9 years ago • 2 comments

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.

timifasubaa avatar Aug 16 '17 23:08 timifasubaa

@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

john-bodley avatar Aug 17 '17 00:08 john-bodley

Which version is this?

xrmx avatar Aug 17 '17 08:08 xrmx