graceguo-supercat commented on a change in pull request #4226: add frontend 
logging functions and log loading time for Dashboard and explore view
URL: 
https://github.com/apache/incubator-superset/pull/4226#discussion_r162804081
 
 

 ##########
 File path: superset/assets/javascripts/chart/chartAction.js
 ##########
 @@ -107,15 +108,27 @@ export const RUN_QUERY = 'RUN_QUERY';
 export function runQuery(formData, force = false, timeout = 60, key) {
   return (dispatch) => {
     const url = getExploreUrl(formData, 'json', force);
+    let logStart;
     const queryRequest = $.ajax({
       url,
       dataType: 'json',
       timeout: timeout * 1000,
+      beforeSend: () => {
+        logStart = Logger.getTimestamp();
+      },
     });
 
     const queryPromise = 
Promise.resolve(dispatch(chartUpdateStarted(queryRequest, key)))
       .then(() => queryRequest)
-      .then(queryResponse => dispatch(chartUpdateSucceeded(queryResponse, 
key)))
+      .then((queryResponse) => {
+        Logger.append(LOAD_EVENT, {
+          label: key,
+          isCached: !force,
+          startAt: logStart,
+          duration: Logger.getTimestamp() - logStart,
+        });
+        dispatch(chartUpdateSucceeded(queryResponse, key));
 
 Review comment:
   Yes. should return dispatch.

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to