You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@superset.apache.org by gi...@git.apache.org on 2017/08/17 00:58:06 UTC

[GitHub] john-bodley commented on issue #3311: slice_id not being logged correctly.

john-bodley commented on issue #3311: slice_id not being logged correctly. 
URL: https://github.com/apache/incubator-superset/issues/3311#issuecomment-322939564
 
 
   @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](https://github.com/apache/incubator-superset/blob/master/superset/models/core.py#L752), 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, 
   ```python
   try:
       slice_id = d.get('slice_id') or json.loads(d.get('form_data')).get('slice_id'))
       slice_id = int(slice_id) if slice_id else 0
   except Exception:
       slice_id = 0
   ```
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services