rpuch commented on code in PR #7422:
URL: https://github.com/apache/ignite-3/pull/7422#discussion_r2844932261
##########
modules/storage-page-memory/src/main/java/org/apache/ignite/internal/storage/pagememory/mv/RunConsistentlyMetrics.java:
##########
@@ -81,10 +76,11 @@ public void recordRunConsistentlyDuration(long
durationNanos) {
}
/**
- * Increments the active count of runConsistently calls.
+ * Increments the active count and total count of runConsistently calls.
*/
public void incrementActiveCount() {
runConsistentlyActiveCount.increment();
+ runConsistentlyTotalCount.increment();
Review Comment:
With this approach, we do 2 increments on entry and 1 decrement on exit. But
we could do just 1 increment on entry (incrementing total number of entries)
and 1 increment on exit (incrementing total number of exits); then we would
have the 'total number of entries' readily available, and we would be able to
calculate active number of operations by doing subtraction (only when metrics
are requested by exporter).
Let's spare this 1 CAS
##########
modules/metrics/src/testFixtures/java/org/apache/ignite/internal/metrics/MetricMatchers.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 static org.hamcrest.Matchers.allOf;
+import static org.hamcrest.Matchers.is;
+import static org.hamcrest.Matchers.notNullValue;
+
+import java.util.Arrays;
+import org.hamcrest.FeatureMatcher;
+import org.hamcrest.Matcher;
+
+/**
+ * Hamcrest matchers for testing metrics.
+ */
+public final class MetricMatchers {
+ private MetricMatchers() {
+ // No-op.
+ }
+
+ /**
+ * Creates a matcher that matches a {@link DistributionMetric} with the
expected total number of measurements
+ * across all histogram buckets.
+ *
+ * @param expectedMeasuresCount Expected total number of measurements
across all buckets.
+ * @return Matcher for distribution metric measures count.
+ */
+ public static Matcher<DistributionMetric> hasMeasuresCount(long
expectedMeasuresCount) {
Review Comment:
Should it be `hasMeasurementsCount`?
--
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]