You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by ak...@apache.org on 2016/10/07 09:50:41 UTC
ignite git commit: IGNITE-3443 WIP.
Repository: ignite
Updated Branches:
refs/heads/ignite-3443 18e370edb -> f805b8b2a
IGNITE-3443 WIP.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/f805b8b2
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/f805b8b2
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/f805b8b2
Branch: refs/heads/ignite-3443
Commit: f805b8b2ab8ac5529c33aa45c8255a438b736038
Parents: 18e370e
Author: Alexey Kuznetsov <ak...@apache.org>
Authored: Fri Oct 7 16:51:54 2016 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Fri Oct 7 16:51:54 2016 +0700
----------------------------------------------------------------------
.../ignite/cache/query/QueryDetailsMetrics.java | 11 ++-
.../cache/query/GridCacheQueryAdapter.java | 2 +-
.../GridCacheQueryDetailsMetricsAdapter.java | 71 +++++++++--------
.../query/GridCacheQueryDetailsMetricsKey.java | 12 +--
.../cache/query/GridCacheQueryManager.java | 77 ++++++++++++------
.../query/GridCacheQueryMetricsAdapter.java | 29 +++----
.../processors/query/GridQueryProcessor.java | 13 ++-
.../cache/VisorCacheQueryDetailsMetrics.java | 83 +++++++++++++++++++-
.../visor/cache/VisorCacheQueryMetrics.java | 66 +++++++++++++++-
.../resources/META-INF/classnames.properties | 1 +
10 files changed, 262 insertions(+), 103 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/f805b8b2/modules/core/src/main/java/org/apache/ignite/cache/query/QueryDetailsMetrics.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/query/QueryDetailsMetrics.java b/modules/core/src/main/java/org/apache/ignite/cache/query/QueryDetailsMetrics.java
index 6f570be..6632288 100644
--- a/modules/core/src/main/java/org/apache/ignite/cache/query/QueryDetailsMetrics.java
+++ b/modules/core/src/main/java/org/apache/ignite/cache/query/QueryDetailsMetrics.java
@@ -45,14 +45,14 @@ public interface QueryDetailsMetrics {
*
* @return Number of completed executions.
*/
- public int completed();
+ public int completions();
/**
* Gets number of times a query execution failed.
*
* @return Number of times a query execution failed.
*/
- public int fails();
+ public int failures();
/**
* Gets minimum execution time of query.
@@ -81,4 +81,11 @@ public interface QueryDetailsMetrics {
* @return Total time of all query executions.
*/
public long totalTime();
+
+ /**
+ * Gets latest query start time.
+ *
+ * @return Latest time query was stared.
+ */
+ public long lastStartTime();
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f805b8b2/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryAdapter.java
index 0f0a2d5..e634179 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryAdapter.java
@@ -441,7 +441,7 @@ public class GridCacheQueryAdapter<T> implements CacheQuery<T> {
* @param duration Duration.
*/
public void onCompleted(Object res, Throwable err, long startTime, long duration) {
- GridQueryProcessor.onCompleted(type, clause, cctx, res, err, startTime, duration, log);
+ GridQueryProcessor.collectMetrics(type, clause, cctx, res, err, startTime, duration, true, log);
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/f805b8b2/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryDetailsMetricsAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryDetailsMetricsAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryDetailsMetricsAdapter.java
index e658e99..1fa90b5 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryDetailsMetricsAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryDetailsMetricsAdapter.java
@@ -41,21 +41,24 @@ public class GridCacheQueryDetailsMetricsAdapter implements QueryDetailsMetrics,
/** Number of executions. */
private int execs;
- /** Number of completed executions. */
- private int completed;
+ /** Number of completions executions. */
+ private int completions;
- /** Number of fails. */
- private int fails;
+ /** Number of failures. */
+ private int failures;
/** Minimum time of execution. */
- private long minTime;
+ private long minTime = -1;
/** Maximum time of execution. */
private long maxTime;
- /** Sum of execution time of completed time. */
+ /** Sum of execution time of completions time. */
private long totalTime;
+ /** Sum of execution time of completions time. */
+ private long lastStartTime;
+
/**
* Required by {@link Externalizable}.
*/
@@ -75,32 +78,27 @@ public class GridCacheQueryDetailsMetricsAdapter implements QueryDetailsMetrics,
}
/**
- * Callback for query execution.
- *
- * @param fail {@code True} query executed unsuccessfully {@code false} otherwise.
- */
- public void onQueryExecute(boolean fail) {
- execs += 1;
-
- if (fail)
- fails += 1;
- }
-
- /**
- * Callback for completion of query execution.
+ * Update metrics on query execution.
*
+ * @param startTime Duration of queue execution.
* @param duration Duration of queue execution.
- * @param fail {@code True} query executed unsuccessfully {@code false} otherwise.
+ * @param failed {@code True} query executed unsuccessfully {@code false} otherwise.
+ * @param completed {@code True} query executed unsuccessfully {@code false} otherwise.
*/
- public void onQueryCompleted(long duration, boolean fail) {
- if (fail)
- fails += 1;
- else {
- completed += 1;
+ public void update(long startTime, long duration, boolean failed, boolean completed) {
+ lastStartTime = startTime;
+
+ if (failed) {
+ execs += 1;
+ failures += 1;
+ }
+ else if (completed) {
+ execs += 1;
+ completions += 1;
totalTime += duration;
- if (minTime == 0 || minTime > duration)
+ if (minTime < 0 || minTime > duration)
minTime = duration;
if (maxTime < duration)
@@ -124,18 +122,18 @@ public class GridCacheQueryDetailsMetricsAdapter implements QueryDetailsMetrics,
}
/** {@inheritDoc} */
- @Override public int completed() {
- return completed;
+ @Override public int completions() {
+ return completions;
}
/** {@inheritDoc} */
- @Override public int fails() {
- return execs - completed;
+ @Override public int failures() {
+ return failures;
}
/** {@inheritDoc} */
@Override public long minimumTime() {
- return minTime;
+ return minTime < 0 ? 0 : minTime;
}
/** {@inheritDoc} */
@@ -145,7 +143,7 @@ public class GridCacheQueryDetailsMetricsAdapter implements QueryDetailsMetrics,
/** {@inheritDoc} */
@Override public double averageTime() {
- double val = completed;
+ double val = completions;
return val > 0 ? totalTime / val : 0;
}
@@ -156,11 +154,16 @@ public class GridCacheQueryDetailsMetricsAdapter implements QueryDetailsMetrics,
}
/** {@inheritDoc} */
+ @Override public long lastStartTime() {
+ return lastStartTime;
+ }
+
+ /** {@inheritDoc} */
@Override public void writeExternal(ObjectOutput out) throws IOException {
U.writeEnum(out, qryType);
U.writeString(out, qry);
out.writeInt(execs);
- out.writeInt(completed);
+ out.writeInt(completions);
out.writeLong(minTime);
out.writeLong(maxTime);
out.writeLong(totalTime);
@@ -171,7 +174,7 @@ public class GridCacheQueryDetailsMetricsAdapter implements QueryDetailsMetrics,
qryType = GridCacheQueryType.fromOrdinal(in.readByte());
qry = U.readString(in);
execs = in.readInt();
- completed = in.readInt();
+ completions = in.readInt();
minTime = in.readLong();
maxTime = in.readLong();
totalTime = in.readLong();
http://git-wip-us.apache.org/repos/asf/ignite/blob/f805b8b2/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryDetailsMetricsKey.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryDetailsMetricsKey.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryDetailsMetricsKey.java
index 1dde61b..0f5b742 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryDetailsMetricsKey.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryDetailsMetricsKey.java
@@ -21,18 +21,18 @@ import java.io.Externalizable;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
-import org.apache.ignite.internal.processors.cache.GridCacheInternal;
+import org.apache.ignite.internal.processors.cache.GridCacheUtilityKey;
/**
* Key for query details metrics to store in system cache.
*/
-public class GridCacheQueryDetailsMetricsKey implements GridCacheInternal, Externalizable {
+public class GridCacheQueryDetailsMetricsKey extends GridCacheUtilityKey<GridCacheQueryDetailsMetricsKey> implements
+ Externalizable {
/** */
private static final long serialVersionUID = 0L;
/** */
- public static final GridCacheQueryDetailsMetricsKey INSTANCE =
- new GridCacheQueryDetailsMetricsKey();
+ public static final GridCacheQueryDetailsMetricsKey INSTANCE = new GridCacheQueryDetailsMetricsKey();
/** {@inheritDoc} */
@Override public int hashCode() {
@@ -40,8 +40,8 @@ public class GridCacheQueryDetailsMetricsKey implements GridCacheInternal, Exter
}
/** {@inheritDoc} */
- @Override public boolean equals(Object obj) {
- return obj == this || (obj instanceof GridCacheQueryDetailsMetricsKey);
+ @Override public boolean equalsx(GridCacheQueryDetailsMetricsKey that) {
+ return true;
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/f805b8b2/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java
index ccbedeb..42d87fa 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java
@@ -118,7 +118,6 @@ import org.apache.ignite.spi.indexing.IndexingSpi;
import org.jetbrains.annotations.Nullable;
import org.jsr166.ConcurrentHashMap8;
-import static java.awt.SystemColor.info;
import static org.apache.ignite.cache.CacheMode.LOCAL;
import static org.apache.ignite.events.EventType.EVT_CACHE_QUERY_EXECUTED;
import static org.apache.ignite.events.EventType.EVT_CACHE_QUERY_OBJECT_READ;
@@ -1729,7 +1728,8 @@ public abstract class GridCacheQueryManager<K, V> extends GridCacheManagerAdapte
if (updStatisticsIfNeeded) {
needUpdStatistics = false;
- cctx.queries().onCompleted(GridCacheQueryType.SCAN, namex, U.currentTimeMillis() - startTime, false);
+ cctx.queries().collectMetrics(GridCacheQueryType.SCAN, namex, startTime,
+ U.currentTimeMillis() - startTime, false, true);
}
final boolean readEvt = cctx.gridEvents().isRecordable(EVT_CACHE_QUERY_OBJECT_READ);
@@ -1794,7 +1794,8 @@ public abstract class GridCacheQueryManager<K, V> extends GridCacheManagerAdapte
}
catch (Exception e) {
if (needUpdStatistics)
- cctx.queries().onCompleted(GridCacheQueryType.SCAN, namex, U.currentTimeMillis() - startTime, true);
+ cctx.queries().collectMetrics(GridCacheQueryType.SCAN, namex, startTime,
+ U.currentTimeMillis() - startTime, true, false);
throw e;
}
@@ -2083,30 +2084,23 @@ public abstract class GridCacheQueryManager<K, V> extends GridCacheManagerAdapte
}
/**
- * @param fail {@code true} if execution failed.
- */
- public void onExecuted(boolean fail) {
- metrics.onQueryExecute(fail);
- }
-
- /**
* @param qryType Query type.
* @param qry Query description.
+ * @param startTime Query start size.
* @param duration Execution duration.
- * @param fail {@code true} if execution failed.
+ * @param failed {@code True} if query execution failed.
+ * @param completed {@code True} if query execution completed.
*/
- public void onCompleted(GridCacheQueryType qryType, String qry, long duration, boolean fail) {
- metrics.onQueryCompleted(duration, fail);
+ public void collectMetrics(GridCacheQueryType qryType, String qry, long startTime, long duration, boolean failed,
+ boolean completed) {
+ if (failed || completed) {
+ metrics.update(duration, failed, completed);
- // TODO IGNITE-3443 execute in separate thread and use entry processor.
- try {
IgniteInternalCache<GridCacheQueryDetailsMetricsKey, Map<Integer, GridCacheQueryDetailsMetricsAdapter>> cache =
- (IgniteInternalCache)cctx.grid().utilityCache();
+ cctx.grid().utilityCache();
- cache.invoke(GridCacheQueryDetailsMetricsKey.INSTANCE, new AddMetricsProcessor(qryType, qry)); /* TODO IGNITE-3443 val.onCompleted(duration, fail); */
- }
- catch (IgniteCheckedException e) {
- throw new IgniteException(e);
+ cache.invokeAsync(GridCacheQueryDetailsMetricsKey.INSTANCE,
+ new AddMetricsProcessor(qryType, qry, startTime, duration, failed, completed));
}
}
@@ -3574,6 +3568,18 @@ public abstract class GridCacheQueryManager<K, V> extends GridCacheManagerAdapte
/** */
private String qry;
+ /** */
+ private long startTime;
+
+ /** */
+ private long duration;
+
+ /** */
+ private boolean failed;
+
+ /** */
+ private boolean completed;
+
/**
* Required by {@link Externalizable}.
*/
@@ -3586,20 +3592,39 @@ public abstract class GridCacheQueryManager<K, V> extends GridCacheManagerAdapte
*
* @param qryType Query type.
* @param qry Query description.
+ * @param startTime Query started time.
+ * @param duration Execution duration.
+ * @param failed {@code true} if execution failed.
+ * @param completed {@code true} if query completed.
*/
- public AddMetricsProcessor(GridCacheQueryType qryType, String qry) {
+ public AddMetricsProcessor(GridCacheQueryType qryType, String qry, long startTime, long duration,
+ boolean failed, boolean completed) {
this.qryType = qryType;
this.qry = qry;
+ this.startTime = startTime;
+ this.duration = duration;
+ this.failed = failed;
+ this.completed = completed;
}
/** {@inheritDoc} */
@Override public void writeExternal(ObjectOutput out) throws IOException {
-
+ U.writeEnum(out, qryType);
+ U.writeString(out, qry);
+ out.writeLong(startTime);
+ out.writeLong(duration);
+ out.writeBoolean(failed);
+ out.writeBoolean(completed);
}
/** {@inheritDoc} */
@Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
-
+ qryType = GridCacheQueryType.fromOrdinal(in.readByte());
+ qry = U.readString(in);
+ startTime = in.readLong();
+ duration = in.readLong();
+ failed = in.readBoolean();
+ completed = in.readBoolean();
}
/** {@inheritDoc} */
@@ -3608,19 +3633,19 @@ public abstract class GridCacheQueryManager<K, V> extends GridCacheManagerAdapte
Object... arguments) throws EntryProcessorException {
Map<Integer, GridCacheQueryDetailsMetricsAdapter> map = entry.getValue();
- Integer qryHash = 31 * qryType.hashCode() + qry.hashCode();
-
if (map == null)
map = new HashMap<>();
else
map = new HashMap<>(map);
+ Integer qryHash = 31 * qryType.hashCode() + qry.hashCode();
+
GridCacheQueryDetailsMetricsAdapter qryMetrics = map.get(qryHash);
if (qryMetrics == null)
qryMetrics = new GridCacheQueryDetailsMetricsAdapter(qryType, qry);
- // TODO: update metrics
+ qryMetrics.update(startTime, duration, failed, completed);
map.put(qryHash, qryMetrics);
http://git-wip-us.apache.org/repos/asf/ignite/blob/f805b8b2/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryMetricsAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryMetricsAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryMetricsAdapter.java
index e70ea9f..edc4033 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryMetricsAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryMetricsAdapter.java
@@ -100,32 +100,23 @@ public class GridCacheQueryMetricsAdapter implements QueryMetrics, Externalizabl
}
/**
- * Callback for query execution.
- *
- * @param fail {@code True} query executed unsuccessfully {@code false} otherwise.
- */
- public void onQueryExecute(boolean fail) {
- execs.increment();
-
- if (fail)
- fails.increment();
- }
-
- /**
- * Callback for completion of query execution.
+ * Update metrics.
*
* @param duration Duration of queue execution.
* @param fail {@code True} query executed unsuccessfully {@code false} otherwise.
*/
- public void onQueryCompleted(long duration, boolean fail) {
- minTime.setIfLess(duration);
- maxTime.setIfGreater(duration);
-
- if (fail)
+ public void update(long duration, boolean fail, boolean complete) {
+ if (fail) {
+ execs.increment();
fails.increment();
- else {
+ }
+ else if (complete) {
+ execs.increment();
completed.increment();
+ minTime.setIfLess(duration);
+ maxTime.setIfGreater(duration);
+
sumTime.add(duration);
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f805b8b2/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
index db7be8b..889cf3d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
@@ -1695,10 +1695,7 @@ public class GridQueryProcessor extends GridProcessorAdapter {
throw new IgniteCheckedException(e);
}
finally {
- cctx.queries().onExecuted(err != null);
-
- if (complete && err == null)
- onCompleted(qryType, qry, cctx, res, null, startTime, U.currentTimeMillis() - startTime, log);
+ collectMetrics(qryType, qry, cctx, res, err, startTime, U.currentTimeMillis() - startTime, complete, log);
}
}
@@ -1712,13 +1709,13 @@ public class GridQueryProcessor extends GridProcessorAdapter {
* @param duration Duration.
* @param log Logger.
*/
- public static void onCompleted(GridCacheQueryType qryType, String qry, GridCacheContext<?, ?> cctx, Object res, Throwable err,
- long startTime, long duration, IgniteLogger log) {
+ public static void collectMetrics(GridCacheQueryType qryType, String qry, GridCacheContext<?, ?> cctx, Object res,
+ Throwable err, long startTime, long duration, boolean completed, IgniteLogger log) {
boolean fail = err != null;
- cctx.queries().onCompleted(qryType, qry, duration, fail);
+ cctx.queries().collectMetrics(qryType, qry, startTime, duration, fail, completed);
- if (log.isTraceEnabled())
+ if (completed && log.isTraceEnabled())
log.trace("Query execution completed [startTime=" + startTime +
", duration=" + duration + ", fail=" + fail + ", res=" + res + ']');
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f805b8b2/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheQueryDetailsMetrics.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheQueryDetailsMetrics.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheQueryDetailsMetrics.java
index b053c28..a9248bb 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheQueryDetailsMetrics.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheQueryDetailsMetrics.java
@@ -17,14 +17,16 @@
package org.apache.ignite.internal.visor.cache;
+import java.io.Serializable;
import org.apache.ignite.cache.query.QueryDetailsMetrics;
+import org.apache.ignite.internal.LessNamingBean;
import org.apache.ignite.internal.processors.cache.query.GridCacheQueryType;
import org.apache.ignite.internal.util.typedef.internal.S;
/**
* Data transfer object for cache query metrics.
*/
-public class VisorCacheQueryDetailsMetrics extends VisorCacheQueryBaseMetrics {
+public class VisorCacheQueryDetailsMetrics implements Serializable, LessNamingBean {
/** */
private static final long serialVersionUID = 0L;
@@ -34,15 +36,41 @@ public class VisorCacheQueryDetailsMetrics extends VisorCacheQueryBaseMetrics {
/** Textual representation of query. */
private String qry;
+ /** Minimum execution time of query. */
+ private long minTime;
+
+ /** Maximum execution time of query. */
+ private long maxTime;
+
+ /** Average execution time of query. */
+ private double avgTime;
+
+ /** Number of query executions. */
+ private int execs;
+
+ /** Number of failed queries. */
+ private int failures;
+
+ /** Number of completed queries. */
+ private int completions;
+
+ /** Latest time query was stared. */
+ private long lastStartTime;
+
/**
* @param m Cache query metrics.
* @return Data transfer object for given cache metrics.
*/
public VisorCacheQueryDetailsMetrics from(QueryDetailsMetrics m) {
- init(m.minimumTime(), m.maximumTime(), m.averageTime(), m.executions(), m.fails());
-
qryType = m.queryType();
qry = m.query();
+ minTime = m.minimumTime();
+ maxTime = m.maximumTime();
+ avgTime = m.averageTime();
+ execs = m.executions();
+ failures = m.failures();
+ completions = m.completions();
+ lastStartTime = m.lastStartTime();
return this;
}
@@ -61,6 +89,55 @@ public class VisorCacheQueryDetailsMetrics extends VisorCacheQueryBaseMetrics {
return qry;
}
+ /**
+ * @return Minimum execution time of query.
+ */
+ public long minimumTime() {
+ return minTime;
+ }
+
+ /**
+ * @return Maximum execution time of query.
+ */
+ public long maximumTime() {
+ return maxTime;
+ }
+
+ /**
+ * @return Average execution time of query.
+ */
+ public double averageTime() {
+ return avgTime;
+ }
+
+ /**
+ * @return Number of executions.
+ */
+ public int executions() {
+ return execs;
+ }
+
+ /**
+ * @return Total number of times a query execution failed.
+ */
+ public int failures() {
+ return failures;
+ }
+
+ /**
+ * @return Total number of times a query execution completed.
+ */
+ public int completions() {
+ return completions;
+ }
+
+ /**
+ * @return Latest time query was stared.
+ */
+ public long lastStartTime() {
+ return lastStartTime;
+ }
+
/** {@inheritDoc} */
@Override public String toString() {
return S.toString(VisorCacheQueryDetailsMetrics.class, this);
http://git-wip-us.apache.org/repos/asf/ignite/blob/f805b8b2/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheQueryMetrics.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheQueryMetrics.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheQueryMetrics.java
index 15ab1ae..a3d77e5 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheQueryMetrics.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheQueryMetrics.java
@@ -17,24 +17,82 @@
package org.apache.ignite.internal.visor.cache;
+import java.io.Serializable;
import org.apache.ignite.cache.query.QueryMetrics;
+import org.apache.ignite.internal.LessNamingBean;
import org.apache.ignite.internal.util.typedef.internal.S;
/**
* Data transfer object for cache query metrics.
*/
-public class VisorCacheQueryMetrics extends VisorCacheQueryBaseMetrics {
+public class VisorCacheQueryMetrics implements Serializable, LessNamingBean {
/** */
private static final long serialVersionUID = 0L;
+ /** Minimum execution time of query. */
+ private long minTime;
+
+ /** Maximum execution time of query. */
+ private long maxTime;
+
+ /** Average execution time of query. */
+ private double avgTime;
+
+ /** Number of executions. */
+ private int execs;
+
+ /** Total number of times a query execution failed. */
+ private int fails;
+
/**
* @param m Cache query metrics.
* @return Data transfer object for given cache metrics.
*/
- public VisorCacheQueryMetrics from(QueryMetrics m) {
- init(m.minimumTime(), m.maximumTime(), m.averageTime(), m.executions(), m.fails());
+ public static VisorCacheQueryMetrics from(QueryMetrics m) {
+ VisorCacheQueryMetrics qm = new VisorCacheQueryMetrics();
+
+ qm.minTime = m.minimumTime();
+ qm.maxTime = m.maximumTime();
+ qm.avgTime = m.averageTime();
+ qm.execs = m.executions();
+ qm.fails = m.fails();
+
+ return qm;
+ }
+
+ /**
+ * @return Minimum execution time of query.
+ */
+ public long minimumTime() {
+ return minTime;
+ }
+
+ /**
+ * @return Maximum execution time of query.
+ */
+ public long maximumTime() {
+ return maxTime;
+ }
+
+ /**
+ * @return Average execution time of query.
+ */
+ public double averageTime() {
+ return avgTime;
+ }
- return this;
+ /**
+ * @return Number of executions.
+ */
+ public int executions() {
+ return execs;
+ }
+
+ /**
+ * @return Total number of times a query execution failed.
+ */
+ public int fails() {
+ return fails;
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/f805b8b2/modules/core/src/main/resources/META-INF/classnames.properties
----------------------------------------------------------------------
diff --git a/modules/core/src/main/resources/META-INF/classnames.properties b/modules/core/src/main/resources/META-INF/classnames.properties
index ade21ce..ed39791 100644
--- a/modules/core/src/main/resources/META-INF/classnames.properties
+++ b/modules/core/src/main/resources/META-INF/classnames.properties
@@ -821,6 +821,7 @@ org.apache.ignite.internal.processors.cache.query.GridCacheDistributedQueryManag
org.apache.ignite.internal.processors.cache.query.GridCacheDistributedQueryManager$7
org.apache.ignite.internal.processors.cache.query.GridCacheQueryAdapter$1
org.apache.ignite.internal.processors.cache.query.GridCacheQueryAdapter$ScanQueryFallbackClosableIterator
+org.apache.ignite.internal.processors.cache.query.GridCacheQueryDetailsMetricsKey
org.apache.ignite.internal.processors.cache.query.GridCacheQueryFutureAdapter$1
org.apache.ignite.internal.processors.cache.query.GridCacheQueryFutureAdapter$2
org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$1$1