superset-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] mistercrunch commented on a change in pull request #4876: Add transaction id's to druid queries
Date Thu, 03 May 2018 17:18:14 GMT
mistercrunch commented on a change in pull request #4876: Add transaction id's to druid queries
URL: https://github.com/apache/incubator-superset/pull/4876#discussion_r185874865
 
 

 ##########
 File path: superset/connectors/druid/models.py
 ##########
 @@ -1148,18 +1151,30 @@ def run_query(  # noqa / druid
             qry['metrics'] = []
             qry['granularity'] = 'all'
             qry['limit'] = row_limit
+            qry['context'] = {'queryId': query_transaction_id}
+            query_start = time.time()
 
 Review comment:
   There's quite a bit of repetition here, how about something like:
   ```python
   # in utils.py
   def run_and_log(func, label=None, logging_method=logging.debug):
       query_start = time.time()
       logging_method('%s - start' % label)
       func()
       logging_method('%s took %0.4f seconds' % (label, (query_stop - query_start)))
       query_stop = time.time()
   
   # then you can simply
   utils.run_and_log_time(lambda: client.scan(**qry), label=query_transaction_id)
   ```

----------------------------------------------------------------
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

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Mime
View raw message