Repository: ignite
Updated Branches:
  refs/heads/ignite-3443 66d88909f -> 5fca6e1e8


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/5fca6e1e
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/5fca6e1e
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/5fca6e1e

Branch: refs/heads/ignite-3443
Commit: 5fca6e1e8f46de5c141baf5abb5c11e9428dfb5b
Parents: 66d8890
Author: Alexey Kuznetsov <akuznet...@apache.org>
Authored: Wed Oct 19 09:45:39 2016 +0700
Committer: Alexey Kuznetsov <akuznet...@apache.org>
Committed: Wed Oct 19 09:45:39 2016 +0700

----------------------------------------------------------------------
 .../ignite/cache/query/QueryDetailsMetrics.java     |  5 +++++
 .../query/GridCacheQueryDetailsMetricsAdapter.java  | 16 +++++++++++++++-
 .../cache/query/GridCacheQueryManager.java          |  2 +-
 3 files changed, 21 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/5fca6e1e/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 2dd9db5..e15373a 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
@@ -34,6 +34,11 @@ public interface QueryDetailsMetrics {
     public String query();
 
     /**
+     * @return Cache where query was executed.
+     */
+    public String cache();
+
+    /**
      * Gets total number execution of query.
      *
      * @return Number of executions.

http://git-wip-us.apache.org/repos/asf/ignite/blob/5fca6e1e/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 90115b8..55979ba 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
@@ -38,6 +38,9 @@ public class GridCacheQueryDetailsMetricsAdapter implements 
QueryDetailsMetrics,
     /** Textual query representation. */
     private String qry;
 
+    /** Cache name. */
+    private String cache;
+
     /** Number of executions. */
     private int execs;
 
@@ -106,7 +109,7 @@ public class GridCacheQueryDetailsMetricsAdapter implements 
QueryDetailsMetrics,
      * @param failed {@code True} query executed unsuccessfully {@code false} 
otherwise.
      * @param completed {@code True} query executed unsuccessfully {@code 
false} otherwise.
      */
-    public void update(long startTime, long duration, boolean failed, boolean 
completed) {
+    public void update(long startTime, long duration, boolean failed, boolean 
completed, String cache) {
         lastStartTime = startTime;
 
         if (failed) {
@@ -125,6 +128,8 @@ public class GridCacheQueryDetailsMetricsAdapter implements 
QueryDetailsMetrics,
             if (maxTime < duration)
                 maxTime = duration;
         }
+
+        this.cache = cache;
     }
 
     /**
@@ -147,6 +152,8 @@ public class GridCacheQueryDetailsMetricsAdapter implements 
QueryDetailsMetrics,
 
         if (maxTime < m.maximumTime())
             maxTime = m.maximumTime();
+
+        cache = m.cache();
     }
 
     /** {@inheritDoc} */
@@ -160,6 +167,11 @@ public class GridCacheQueryDetailsMetricsAdapter 
implements QueryDetailsMetrics,
     }
 
     /** {@inheritDoc} */
+    @Override public String cache() {
+        return cache;
+    }
+
+    /** {@inheritDoc} */
     @Override public int executions() {
         return execs;
     }
@@ -205,6 +217,7 @@ public class GridCacheQueryDetailsMetricsAdapter implements 
QueryDetailsMetrics,
     @Override public void writeExternal(ObjectOutput out) throws IOException {
         U.writeEnum(out, qryType);
         U.writeString(out, qry);
+        U.writeString(out, cache);
         out.writeInt(execs);
         out.writeInt(completions);
         out.writeLong(minTime);
@@ -217,6 +230,7 @@ public class GridCacheQueryDetailsMetricsAdapter implements 
QueryDetailsMetrics,
     @Override public void readExternal(ObjectInput in) throws IOException, 
ClassNotFoundException {
         qryType = GridCacheQueryType.fromOrdinal(in.readByte());
         qry = U.readString(in);
+        cache = U.readString(in);
         execs = in.readInt();
         completions = in.readInt();
         minTime = in.readLong();

http://git-wip-us.apache.org/repos/asf/ignite/blob/5fca6e1e/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 36f3ede..418417d 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
@@ -2126,7 +2126,7 @@ public abstract class GridCacheQueryManager<K, V> extends 
GridCacheManagerAdapte
                     if (qryMetrics == null)
                         qryMetrics = new 
GridCacheQueryDetailsMetricsAdapter(qryType, qry);
 
-                    
((GridCacheQueryDetailsMetricsAdapter)qryMetrics).update(startTime, duration, 
failed, completed);
+                    
((GridCacheQueryDetailsMetricsAdapter)qryMetrics).update(startTime, duration, 
failed, completed, cctx.name());
 
                     // Leave if updated.
                     if (qryHist.putIfAbsent(qryHash, qryMetrics) == null)

Reply via email to