denominator) {
+ this.numerator = numerator;
+ this.denominator = denominator;
+ }
+
+ @Override
+ protected Ratio getRatio() {
+ Integer numValue = numerator.getValue();
+ Integer denomValue = denominator.getValue();
+ if (numValue != null && denomValue != null) {
+ return Ratio.of(numValue.doubleValue(), denomValue.doubleValue());
+ }
+ return Ratio.of(0d, 0d);
+ }
+}
diff --git a/kylin/core-common/src/main/java/org/apache/kylin/common/metrics/metrics2/Metrics2Reporter.java b/kylin/core-common/src/main/java/org/apache/kylin/common/metrics/metrics2/Metrics2Reporter.java
new file mode 100644
index 000000000..d1c3c7fe0
--- /dev/null
+++ b/kylin/core-common/src/main/java/org/apache/kylin/common/metrics/metrics2/Metrics2Reporter.java
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+
+package org.apache.kylin.common.metrics.metrics2;
+
+import java.util.concurrent.TimeUnit;
+
+import org.apache.hadoop.metrics2.lib.DefaultMetricsSystem;
+import org.apache.kylin.common.KylinConfig;
+
+import com.codahale.metrics.MetricRegistry;
+import com.github.joshelser.dropwizard.metrics.hadoop.HadoopMetrics2Reporter;
+
+/**
+ * A wrapper around Codahale HadoopMetrics2Reporter to make it a pluggable/configurable Hive Metrics reporter.
+ */
+public class Metrics2Reporter implements CodahaleReporter {
+
+ private final MetricRegistry metricRegistry;
+ private final KylinConfig conf;
+ private final HadoopMetrics2Reporter reporter;
+
+ public Metrics2Reporter(MetricRegistry registry, KylinConfig conf) {
+ this.metricRegistry = registry;
+ this.conf = conf;
+ String applicationName = "kylin";
+
+ reporter = HadoopMetrics2Reporter.forRegistry(metricRegistry).convertRatesTo(TimeUnit.SECONDS)
+ .convertDurationsTo(TimeUnit.MILLISECONDS).build(DefaultMetricsSystem.initialize(applicationName), // The application-level name
+ applicationName, // Component name
+ applicationName, // Component description
+ "General"); // Name for each metric record
+ }
+
+ @Override
+ public void start() {
+ long reportingInterval = 30;
+ reporter.start(reportingInterval, TimeUnit.SECONDS);
+ }
+
+ @Override
+ public void close() {
+ reporter.close();
+ }
+}
diff --git a/kylin/core-common/src/main/java/org/apache/kylin/common/metrics/metrics2/MetricsReporting.java b/kylin/core-common/src/main/java/org/apache/kylin/common/metrics/metrics2/MetricsReporting.java
new file mode 100644
index 000000000..fc1b66364
--- /dev/null
+++ b/kylin/core-common/src/main/java/org/apache/kylin/common/metrics/metrics2/MetricsReporting.java
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+
+package org.apache.kylin.common.metrics.metrics2;
+
+/**
+ * Reporting options for org.apache.hadoop.hive.common.metrics.metrics2.Metrics.
+ */
+public enum MetricsReporting {
+ JMX, CONSOLE, JSON_FILE, HADOOP2
+}
diff --git a/kylin/core-common/src/main/java/org/apache/kylin/common/metrics/perflog/IPerfLogger.java b/kylin/core-common/src/main/java/org/apache/kylin/common/metrics/perflog/IPerfLogger.java
new file mode 100644
index 000000000..83a421009
--- /dev/null
+++ b/kylin/core-common/src/main/java/org/apache/kylin/common/metrics/perflog/IPerfLogger.java
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+
+package org.apache.kylin.common.metrics.perflog;
+
+public interface IPerfLogger {
+
+ /**
+ * Call this function when you start to measure time spent by a piece of code.
+ *
+ * @param callerName the logging object to be used.
+ * @param method method or ID that identifies this perf log element.
+ */
+ public void perfLogBegin(String callerName, String method);
+
+ /**
+ * Call this function in correspondence of perfLogBegin to mark the end of the measurement.
+ *
+ * @param callerName
+ * @param method
+ * @return long duration the difference between now and startTime, or -1 if startTime is null
+ */
+ public long perfLogEnd(String callerName, String method);
+
+ /**
+ * Call this function in correspondence of perfLogBegin to mark the end of the measurement.
+ *
+ * @param callerName
+ * @param method
+ * @return long duration the difference between now and startTime, or -1 if startTime is null
+ */
+ public long perfLogEnd(String callerName, String method, String additionalInfo);
+}
diff --git a/kylin/core-common/src/main/java/org/apache/kylin/common/metrics/perflog/PerfLogger.java b/kylin/core-common/src/main/java/org/apache/kylin/common/metrics/perflog/PerfLogger.java
new file mode 100644
index 000000000..361a65428
--- /dev/null
+++ b/kylin/core-common/src/main/java/org/apache/kylin/common/metrics/perflog/PerfLogger.java
@@ -0,0 +1,160 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+
+package org.apache.kylin.common.metrics.perflog;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.kylin.common.metrics.common.Metrics;
+import org.apache.kylin.common.metrics.common.MetricsConstant;
+import org.apache.kylin.common.metrics.common.MetricsFactory;
+import org.apache.kylin.common.metrics.common.MetricsScope;
+import org.apache.kylin.common.metrics.common.Metricss;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.collect.ImmutableMap;
+
+
+/**
+ * PerfLogger.
+ *
+ * Can be used to measure and log the time spent by a piece of code.
+ */
+public class PerfLogger implements IPerfLogger {
+
+ static final private Logger LOG = LoggerFactory.getLogger(PerfLogger.class.getName());
+ protected final Map startTimes = new HashMap();
+ protected final Map endTimes = new HashMap();
+ //Methods for metrics integration. Each thread-local PerfLogger will open/close scope during each perf-log method.
+ transient Map openScopes = new HashMap();
+
+ public void perfLogBegin(String callerName, String method) {
+ long startTime = System.currentTimeMillis();
+ startTimes.put(method, new Long(startTime));
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("");
+ }
+ beginMetrics(callerName + "." + method);
+ }
+
+ public long perfLogEnd(String callerName, String method) {
+ return perfLogEnd(callerName, method, null);
+ }
+
+ public long perfLogEnd(String callerName, String method, String additionalInfo) {
+ Long startTime = startTimes.get(method);
+ long endTime = System.currentTimeMillis();
+ endTimes.put(method, new Long(endTime));
+ long duration = startTime == null ? -1 : endTime - startTime.longValue();
+
+ if (LOG.isDebugEnabled()) {
+ StringBuilder sb = new StringBuilder("");
+ LOG.debug(sb.toString());
+ }
+ endMetrics(callerName + "." + method);
+ return duration;
+ }
+
+ public Long getStartTime(String method) {
+ long startTime = 0L;
+
+ if (startTimes.containsKey(method)) {
+ startTime = startTimes.get(method);
+ }
+ return startTime;
+ }
+
+ public Long getEndTime(String method) {
+ long endTime = 0L;
+
+ if (endTimes.containsKey(method)) {
+ endTime = endTimes.get(method);
+ }
+ return endTime;
+ }
+
+ public boolean startTimeHasMethod(String method) {
+ return startTimes.containsKey(method);
+ }
+
+ public boolean endTimeHasMethod(String method) {
+ return endTimes.containsKey(method);
+ }
+
+ public Long getDuration(String method) {
+ long duration = 0;
+ if (startTimes.containsKey(method) && endTimes.containsKey(method)) {
+ duration = endTimes.get(method) - startTimes.get(method);
+ }
+ return duration;
+ }
+
+ public ImmutableMap getStartTimes() {
+ return ImmutableMap.copyOf(startTimes);
+ }
+
+ public ImmutableMap getEndTimes() {
+ return ImmutableMap.copyOf(endTimes);
+ }
+
+ private void beginMetrics(String method) {
+ Metrics metrics = MetricsFactory.getInstance();
+ if (metrics != null) {
+ MetricsScope scope = metrics.createScope(method);
+ openScopes.put(method, scope);
+ }
+
+ }
+
+ private void endMetrics(String method) {
+ Metrics metrics = MetricsFactory.getInstance();
+ if (metrics != null) {
+ MetricsScope scope = openScopes.remove(method);
+ if (scope != null) {
+ metrics.endScope(scope);
+ }
+ }
+ }
+
+ /**
+ * Cleans up any dangling perfLog metric call scopes.
+ */
+ public void cleanupPerfLogMetrics() {
+ Metrics metrics = MetricsFactory.getInstance();
+ if (metrics != null) {
+ for (MetricsScope openScope : openScopes.values()) {
+ metrics.endScope(openScope);
+ }
+ }
+ openScopes.clear();
+ }
+}
diff --git a/kylin/core-common/src/main/java/org/apache/kylin/common/metrics/perflog/PerfLoggerFactory.java b/kylin/core-common/src/main/java/org/apache/kylin/common/metrics/perflog/PerfLoggerFactory.java
new file mode 100644
index 000000000..c76aece81
--- /dev/null
+++ b/kylin/core-common/src/main/java/org/apache/kylin/common/metrics/perflog/PerfLoggerFactory.java
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+
+package org.apache.kylin.common.metrics.perflog;
+
+import org.apache.commons.lang3.ClassUtils;
+import org.apache.kylin.common.KylinConfig;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class PerfLoggerFactory {
+
+ protected static final ThreadLocal perfLogger = new ThreadLocal();
+ static final private Logger LOG = LoggerFactory.getLogger(PerfLoggerFactory.class.getName());
+
+ public static IPerfLogger getPerfLogger() {
+ return getPerfLogger(false);
+ }
+
+ public static void setPerfLogger(IPerfLogger resetKAPPerfLogger) {
+ perfLogger.set(resetKAPPerfLogger);
+ }
+
+ public static IPerfLogger getPerfLogger(boolean resetPerfLogger) {
+ IPerfLogger result = perfLogger.get();
+ if (resetPerfLogger || result == null) {
+ try {
+ result = (IPerfLogger) ClassUtils.getClass(KylinConfig.getInstanceFromEnv().getPerfLoggerClassName())
+ .newInstance();
+ } catch (ClassNotFoundException e) {
+ LOG.error("Performance Logger Class not found:" + e.getMessage());
+ result = new SimplePerfLogger();
+ } catch (IllegalAccessException | InstantiationException e) {
+ e.printStackTrace();
+ }
+ perfLogger.set(result);
+ }
+ return result;
+ }
+
+}
diff --git a/kylin/core-common/src/main/java/org/apache/kylin/common/metrics/perflog/SimplePerfLogger.java b/kylin/core-common/src/main/java/org/apache/kylin/common/metrics/perflog/SimplePerfLogger.java
new file mode 100644
index 000000000..cd88c6548
--- /dev/null
+++ b/kylin/core-common/src/main/java/org/apache/kylin/common/metrics/perflog/SimplePerfLogger.java
@@ -0,0 +1,73 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+
+package org.apache.kylin.common.metrics.perflog;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class SimplePerfLogger implements IPerfLogger {
+
+ static final private Logger LOG = LoggerFactory.getLogger(SimplePerfLogger.class.getName());
+ protected final Map startTimes = new HashMap();
+ protected final Map endTimes = new HashMap();
+
+ protected SimplePerfLogger() {
+ }
+
+ public void perfLogBegin(String callerName, String method) {
+ long startTime = System.currentTimeMillis();
+ startTimes.put(method, new Long(startTime));
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("");
+ }
+ }
+
+ public long perfLogEnd(String callerName, String method) {
+ return perfLogEnd(callerName, method, null);
+ }
+
+ public long perfLogEnd(String callerName, String method, String additionalInfo) {
+ Long startTime = startTimes.get(method);
+ long endTime = System.currentTimeMillis();
+ endTimes.put(method, new Long(endTime));
+ long duration = startTime == null ? -1 : endTime - startTime.longValue();
+
+ if (LOG.isDebugEnabled()) {
+ StringBuilder sb = new StringBuilder("");
+ LOG.debug(sb.toString());
+ }
+ return duration;
+ }
+
+}
diff --git a/kylin/pom.xml b/kylin/pom.xml
index 732deac41..ff4a9ebf6 100644
--- a/kylin/pom.xml
+++ b/kylin/pom.xml
@@ -122,6 +122,8 @@
2.6.4
1.8.9
+ 3.1.2
+
jacoco
reuseReports
diff --git a/kylin/server-base/src/main/java/org/apache/kylin/rest/metrics/QueryMetrics2Facade.java b/kylin/server-base/src/main/java/org/apache/kylin/rest/metrics/QueryMetrics2Facade.java
new file mode 100644
index 000000000..afbf4a64b
--- /dev/null
+++ b/kylin/server-base/src/main/java/org/apache/kylin/rest/metrics/QueryMetrics2Facade.java
@@ -0,0 +1,94 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.kylin.rest.metrics;
+
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.TimeUnit;
+
+import javax.annotation.concurrent.ThreadSafe;
+
+import org.apache.hadoop.metrics2.MetricsException;
+import org.apache.hadoop.metrics2.lib.DefaultMetricsSystem;
+import org.apache.kylin.common.KylinConfig;
+import org.apache.kylin.common.metrics.common.Metrics;
+import org.apache.kylin.common.metrics.common.MetricsConstant;
+import org.apache.kylin.common.metrics.common.MetricsFactory;
+import org.apache.kylin.common.metrics.common.Metricss;
+import org.apache.kylin.rest.request.SQLRequest;
+import org.apache.kylin.rest.response.SQLResponse;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import static org.apache.kylin.common.metrics.common.MetricsConstant.TOTAL;
+import static org.apache.kylin.common.metrics.common.Metricss.buildCubeMetricPrefix;
+
+/**
+ * The entrance of metrics features.
+ */
+@ThreadSafe
+public class QueryMetrics2Facade {
+
+ private static final Logger logger = LoggerFactory.getLogger(QueryMetrics2Facade.class);
+ private static Metrics metrics ;
+
+ public static void updateMetrics(SQLRequest sqlRequest, SQLResponse sqlResponse) {
+ if(metrics == null){
+ metrics = MetricsFactory.getInstance();
+ }
+ String projectName = sqlRequest.getProject();
+ String cubeName = sqlResponse.getCube().replace("=","->");
+
+// update(getQueryMetrics("Server_Total"), sqlResponse);
+ update(buildCubeMetricPrefix(TOTAL),sqlResponse);
+ update(buildCubeMetricPrefix(projectName), sqlResponse);
+ String cubeMetricName =buildCubeMetricPrefix(projectName,cubeName);
+ update(cubeMetricName, sqlResponse);
+ }
+
+ private static void update(String name, SQLResponse sqlResponse) {
+ try {
+ incrQueryCount(name, sqlResponse);
+ incrCacheHitCount(name, sqlResponse);
+ if (!sqlResponse.getIsException()) {
+ metrics.updateTimer(Metricss.buildMetric(name, MetricsConstant.QUERY_DURATION), sqlResponse.getDuration(),TimeUnit.MILLISECONDS);
+ metrics.updateHistogram(Metricss.buildMetric(name, MetricsConstant.QUERY_RESULT_ROWCOUNT), sqlResponse.getResults().size());
+ metrics.updateHistogram(Metricss.buildMetric(name, MetricsConstant.QUERY_SCAN_ROWCOUNT), sqlResponse.getTotalScanCount());
+ }
+ } catch (Exception e) {
+ logger.error(e.getMessage());
+ }
+
+ }
+
+ private static void incrQueryCount(String name, SQLResponse sqlResponse) {
+ if (!sqlResponse.isHitExceptionCache() && !sqlResponse.getIsException()) {
+ metrics.incrementCounter(Metricss.buildMetric(name, MetricsConstant.QUERY_SUCCESS_COUNT));
+ } else {
+ metrics.incrementCounter(Metricss.buildMetric(name, MetricsConstant.QUERY_FAIL_COUNT));
+ }
+ metrics.incrementCounter(Metricss.buildMetric(name, MetricsConstant.QUERY_COUNT));
+ }
+
+ private static void incrCacheHitCount(String name, SQLResponse sqlResponse) {
+ if (sqlResponse.isStorageCacheUsed()) {
+ metrics.incrementCounter(Metricss.buildMetric(name, MetricsConstant.QUERY_CACHE_COUNT));
+ }
+ }
+
+}
diff --git a/kylin/server-base/src/main/java/org/apache/kylin/rest/service/QueryService.java b/kylin/server-base/src/main/java/org/apache/kylin/rest/service/QueryService.java
index f4ae06ca1..6e9e4b3f6 100644
--- a/kylin/server-base/src/main/java/org/apache/kylin/rest/service/QueryService.java
+++ b/kylin/server-base/src/main/java/org/apache/kylin/rest/service/QueryService.java
@@ -58,6 +58,8 @@ import org.apache.kylin.common.KylinConfig;
import org.apache.kylin.common.QueryContext;
import org.apache.kylin.common.debug.BackdoorToggles;
import org.apache.kylin.common.exceptions.ResourceLimitExceededException;
+import org.apache.kylin.common.metrics.perflog.IPerfLogger;
+import org.apache.kylin.common.metrics.perflog.PerfLoggerFactory;
import org.apache.kylin.common.persistence.ResourceStore;
import org.apache.kylin.common.persistence.RootPersistentEntity;
import org.apache.kylin.common.persistence.Serializer;
@@ -86,6 +88,7 @@ import org.apache.kylin.query.util.QueryUtil;
import org.apache.kylin.rest.constant.Constant;
import org.apache.kylin.rest.exception.BadRequestException;
import org.apache.kylin.rest.exception.InternalErrorException;
+import org.apache.kylin.rest.metrics.QueryMetrics2Facade;
import org.apache.kylin.rest.metrics.QueryMetricsFacade;
import org.apache.kylin.rest.model.Query;
import org.apache.kylin.rest.msg.Message;
@@ -129,6 +132,7 @@ public class QueryService extends BasicService {
private static final Logger logger = LoggerFactory.getLogger(QueryService.class);
final BadQueryDetector badQueryDetector = new BadQueryDetector();
final ResourceStore queryStore;
+ public static final String CLASS_NAME = QueryService.class.getCanonicalName();
@Autowired
protected CacheManager cacheManager;
@@ -170,6 +174,8 @@ public class QueryService extends BasicService {
}
public SQLResponse query(SQLRequest sqlRequest) throws Exception {
+ IPerfLogger perfLogger = PerfLoggerFactory.getPerfLogger();
+ perfLogger.perfLogBegin(CLASS_NAME, "query");
try {
final String user = SecurityContextHolder.getContext().getAuthentication().getName();
badQueryDetector.queryStart(Thread.currentThread(), sqlRequest, user);
@@ -178,6 +184,8 @@ public class QueryService extends BasicService {
} finally {
badQueryDetector.queryEnd(Thread.currentThread());
+ perfLogger.perfLogEnd(QueryService.class.getName(), "query");
+
}
}
@@ -434,6 +442,7 @@ public class QueryService extends BasicService {
logQuery(sqlRequest, sqlResponse);
+ QueryMetrics2Facade.updateMetrics(sqlRequest, sqlResponse);
QueryMetricsFacade.updateMetrics(sqlRequest, sqlResponse);
if (sqlResponse.getIsException())
@@ -504,7 +513,9 @@ public class QueryService extends BasicService {
// force clear the query context before a new query
OLAPContext.clearThreadLocalContexts();
- return execute(correctedSql, sqlRequest);
+ SQLResponse sqlResponse = execute(correctedSql, sqlRequest);
+
+ return sqlResponse;
}
@@ -751,7 +762,6 @@ public class QueryService extends BasicService {
Statement stat = null;
ResultSet resultSet = null;
Boolean isPushDown = false;
-
List> results = Lists.newArrayList();
List columnMetas = Lists.newArrayList();
--
2.13.2 (Apple Git-90)