sk0x50 commented on code in PR #3645:
URL: https://github.com/apache/ignite-3/pull/3645#discussion_r1582660863


##########
modules/metrics/src/main/java/org/apache/ignite/internal/metrics/MovingAverageMetric.java:
##########
@@ -0,0 +1,93 @@
+/*
+ * 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.ignite.internal.metrics;
+
+import java.util.concurrent.ConcurrentLinkedDeque;
+import java.util.function.DoubleFunction;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * The metric calculates the average value for the last several operations.
+ */
+public class MovingAverageMetric extends AbstractMetric implements 
DoubleMetric {
+    /** Default rate. */

Review Comment:
   I think this is not a rate. `window size`?



##########
modules/metastorage/src/integrationTest/java/org/apache/ignite/internal/metastorage/impl/ItMetaStorageManagerImplTest.java:
##########
@@ -110,7 +111,8 @@ void setUp(
 
         var raftGroupEventsClientListener = new 
RaftGroupEventsClientListener();
 
-        raftManager = new Loza(clusterService, raftConfiguration, 
workDir.resolve("loza"), clock, raftGroupEventsClientListener);
+        raftManager = new Loza(clusterService, new MetricManager(), 
raftConfiguration, workDir.resolve("loza"), clock,

Review Comment:
   Perhaps, it makes sense to add `NoOpMetricManager` to the 
`metrics/testFixtures` module that does not require any logic on 
starting/stopping.



##########
modules/metrics/src/main/java/org/apache/ignite/internal/metrics/DistributionMetric.java:
##########
@@ -59,18 +60,34 @@ public class DistributionMetric extends AbstractMetric 
implements CompositeMetri
     /** Bounds of measurements. */
     private final long[] bounds;
 
+    /** Value string formatter or {@code null} to use default formatter. */

Review Comment:
   It seems to me, that this change should be applied to all metric classes: 
`IntMetric`, `IntGaguge` etc



##########
modules/metrics/src/main/java/org/apache/ignite/internal/metrics/DistributionMetric.java:
##########
@@ -59,18 +60,34 @@ public class DistributionMetric extends AbstractMetric 
implements CompositeMetri
     /** Bounds of measurements. */
     private final long[] bounds;
 
+    /** Value string formatter or {@code null} to use default formatter. */
+    private final Function<long[], String> stringFormatter;
+
     /** List of scalar metrics. */
     private volatile List<Metric> scalarMetrics = null;
 
     /**
-     * The constructor.
+     * Constructor.

Review Comment:
   You removed the article but added it a few lines below :)



##########
modules/metrics/src/main/java/org/apache/ignite/internal/metrics/MovingAverageMetric.java:
##########
@@ -0,0 +1,93 @@
+/*
+ * 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.ignite.internal.metrics;
+
+import java.util.concurrent.ConcurrentLinkedDeque;
+import java.util.function.DoubleFunction;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * The metric calculates the average value for the last several operations.
+ */
+public class MovingAverageMetric extends AbstractMetric implements 
DoubleMetric {

Review Comment:
   Let's rename this class as `SimpleMovingAverage`



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to