You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by GitBox <gi...@apache.org> on 2020/02/27 13:52:05 UTC

[GitHub] [ignite] Vladsz83 commented on a change in pull request #7446: IGNITE-12464 : Service metrics

Vladsz83 commented on a change in pull request #7446: IGNITE-12464 : Service metrics
URL: https://github.com/apache/ignite/pull/7446#discussion_r385137912
 
 

 ##########
 File path: modules/core/src/test/java/org/apache/ignite/internal/processors/service/GridServiceMetricsTest.java
 ##########
 @@ -0,0 +1,418 @@
+package org.apache.ignite.internal.processors.service;
+
+import java.lang.reflect.Method;
+import java.util.List;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.stream.Collectors;
+import java.util.stream.LongStream;
+import java.util.stream.Stream;
+import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.internal.processors.metric.GridMetricManager;
+import org.apache.ignite.internal.processors.metric.MetricRegistry;
+import org.apache.ignite.internal.processors.service.inner.MyService;
+import org.apache.ignite.internal.processors.service.inner.MyServiceFactory;
+import org.apache.ignite.internal.processors.service.inner.NamingService;
+import org.apache.ignite.internal.processors.service.inner.NamingServiceImpl;
+import org.apache.ignite.services.Service;
+import org.apache.ignite.services.ServiceConfiguration;
+import org.apache.ignite.spi.metric.HistogramMetric;
+import org.apache.ignite.spi.metric.Metric;
+import org.apache.ignite.spi.metric.ReadOnlyMetricRegistry;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.junit.Test;
+
+import static org.apache.ignite.IgniteSystemProperties.IGNITE_SERVICE_METRICS_ENABLED;
+import static org.apache.ignite.internal.processors.service.IgniteServiceProcessor.METRIC_REGISTRY_INVOCATIONS;
+
+/** */
+public class GridServiceMetricsTest extends GridCommonAbstractTest {
+    /** Number of service invcations. */
+    private static final int INVOKE_CNT = 50;
+
+    /** Utility holder of current grid number. */
+    private final AtomicInteger gridNum = new AtomicInteger();
+
+    /** */
+    @Override protected void afterTest() throws Exception {
+        stopAllGrids();
+
+        super.afterTest();
+    }
+
+    /** */
+    @Override protected void beforeTest() throws Exception {
+        super.beforeTest();
+
+        System.clearProperty(IGNITE_SERVICE_METRICS_ENABLED);
+    }
+
+    /** Makes sure {@code IgniteSystemProperties#IGNITE_SERVICE_METRICS_ENABLED} works correctly. */
+    @Test
+    public void testMetricsEnabledDisabled() throws Throwable {
+        IgniteEx server = startGrid(0);
+
+        assertFalse("Service metric registry must not be created yet.",
+            findMetric(server.context().metric(), METRIC_REGISTRY_INVOCATIONS));
+
+        String srvcName = "testMetricsEnabledService";
+
+        server.services().deploy(serviceCfg(srvcName, 1, 1));
+
+        assertTrue("Service metric registry must be already created.",
+            findMetric(server.context().metric(), METRIC_REGISTRY_INVOCATIONS));
+
+        stopAllGrids();
+
+        System.setProperty(IGNITE_SERVICE_METRICS_ENABLED, "false");
 
 Review comment:
   Isn't it redundant safety? This is new specific parameter, unused in other tests.

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