From edf2461977d57d4d62992c228d2f7b9e3abf8fb3 Mon Sep 17 00:00:00 2001 From: Pavel Tiunov Date: Sun, 12 Apr 2020 17:53:35 -0700 Subject: [PATCH] fix: Include data transformation in Load Request time --- packages/cubejs-api-gateway/index.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/packages/cubejs-api-gateway/index.js b/packages/cubejs-api-gateway/index.js index 9d18be4b7a686..8359c1ad33f54 100644 --- a/packages/cubejs-api-gateway/index.js +++ b/packages/cubejs-api-gateway/index.js @@ -409,17 +409,12 @@ class ApiGateway { const response = await this.getAdapterApi({ ...context, dataSource: sqlQuery.dataSource }).executeQuery(toExecute); - this.log(context, { - type: 'Load Request Success', - query, - duration: this.duration(requestStarted) - }); const flattenAnnotation = { ...annotation.measures, ...annotation.dimensions, ...annotation.timeDimensions }; - res({ + const result = { query: normalizedQuery, data: transformData(aliasToMemberNameMap, flattenAnnotation, response.data, normalizedQuery), lastRefreshTime: response.lastRefreshTime && response.lastRefreshTime.toISOString(), @@ -428,7 +423,13 @@ class ApiGateway { usedPreAggregations: response.usedPreAggregations }), annotation + }; + this.log(context, { + type: 'Load Request Success', + query, + duration: this.duration(requestStarted) }); + res(result); } catch (e) { this.handleError({ e, context, query, res, requestStarted