ignite-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [ignite] Mmuzaf commented on a change in pull request #6627: IGNITE-11925: QueryMetrics migration.
Date Thu, 11 Jul 2019 11:35:35 GMT
Mmuzaf commented on a change in pull request #6627: IGNITE-11925: QueryMetrics migration.
URL: https://github.com/apache/ignite/pull/6627#discussion_r302495770
 
 

 ##########
 File path: modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryMetricsAdapter.java
 ##########
 @@ -126,41 +125,106 @@ public void update(long duration, boolean fail) {
      *
      * @return Copy.
      */
-    public GridCacheQueryMetricsAdapter copy() {
-        GridCacheQueryMetricsAdapter m = new GridCacheQueryMetricsAdapter();
-
-        // Not synchronized because accuracy isn't critical.
-        m.fails.add(fails.sum());
-        m.minTime.set(minTime.get());
-        m.maxTime.set(maxTime.get());
-        m.execs.add(execs.sum());
-        m.completed.add(completed.sum());
-        m.sumTime.add(sumTime.sum());
-        m.avgTime = avgTime;
-
-        return m;
-    }
-
-    /** {@inheritDoc} */
-    @Override public void writeExternal(ObjectOutput out) throws IOException {
-        out.writeLong(minTime.get());
-        out.writeLong(maxTime.get());
-        out.writeDouble(averageTime());
-        out.writeInt(execs.intValue());
-        out.writeInt(fails.intValue());
+    public QueryMetrics snapshot() {
+        long minTimeVal = minTime.longValue();
+
+        return new QueryMetricsSnapshot(
+            minTimeVal == Long.MAX_VALUE ? 0 : minTimeVal,
 
 Review comment:
   This is not related to your changes directly. But I think it is a time when we can fix
it (it affects public metrics value).
   `GridCacheQueryDetailMetricsAdapter` sets `minTime` to `-1` and it seems to me that it
is more natural to have a negative default value for this parameter rather than `Long.MAX_VALUE`.
   
   Just mark this comment `resolved` if we don't need it here.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message