[GitHub] [ignite] alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: Monitoring list engine.

2019-09-20 Thread GitBox
alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: 
Monitoring list engine.
URL: https://github.com/apache/ignite/pull/6845#discussion_r326640572
 
 

 ##
 File path: 
modules/core/src/test/java/org/apache/ignite/internal/metric/SystemViewSelfTest.java
 ##
 @@ -0,0 +1,400 @@
+/*
+ * 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.metric;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.BrokenBarrierException;
+import java.util.concurrent.CyclicBarrier;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.IgniteCompute;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.compute.ComputeJob;
+import org.apache.ignite.compute.ComputeJobResult;
+import org.apache.ignite.compute.ComputeJobResultPolicy;
+import org.apache.ignite.compute.ComputeTask;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.lang.IgniteCallable;
+import org.apache.ignite.lang.IgniteClosure;
+import org.apache.ignite.lang.IgnitePredicate;
+import org.apache.ignite.lang.IgniteRunnable;
+import org.apache.ignite.spi.systemview.view.SystemView;
+import org.apache.ignite.spi.systemview.view.CacheGroupView;
+import org.apache.ignite.spi.systemview.view.CacheView;
+import org.apache.ignite.spi.systemview.view.ComputeTaskView;
+import org.apache.ignite.spi.systemview.view.ServiceView;
+import org.apache.ignite.internal.processors.service.DummyService;
+import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.services.ServiceConfiguration;
+import org.apache.ignite.testframework.GridTestUtils;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+import org.junit.Test;
+
+import static 
org.apache.ignite.internal.processors.cache.ClusterCachesInfo.CACHES_VIEW;
+import static 
org.apache.ignite.internal.processors.cache.ClusterCachesInfo.CACHE_GRPS_VIEW;
+import static 
org.apache.ignite.internal.processors.service.IgniteServiceProcessor.SVCS_VIEW;
+import static 
org.apache.ignite.internal.processors.task.GridTaskProcessor.TASKS_VIEW;
+
+/** Tests for {@link SystemView}. */
+public class SystemViewSelfTest extends GridCommonAbstractTest {
+/** Tests work of {@link SystemView} for caches. */
+@Test
+public void testCachesView() throws Exception {
+try (IgniteEx g = startGrid()) {
+Set cacheNames = new HashSet<>(Arrays.asList("cache-1", 
"cache-2"));
+
+for (String name : cacheNames)
+g.createCache(name);
+
+SystemView caches = 
g.context().systemView().view(CACHES_VIEW);
+
+assertEquals(g.context().cache().cacheDescriptors().size(), 
F.size(caches.iterator()));
+
+for (CacheView row : caches)
+cacheNames.remove(row.cacheName());
+
+assertTrue(cacheNames.toString(), cacheNames.isEmpty());
+}
+}
+
+/** Tests work of {@link SystemView} for cache groups. */
+@Test
+public void testCacheGroupsView() throws Exception {
+try (IgniteEx g = startGrid()) {
+Set grpNames = new HashSet<>(Arrays.asList("grp-1", 
"grp-2"));
+
+for (String grpName : grpNames)
+g.createCache(new CacheConfiguration<>("cache-" + 
grpName).setGroupName(grpName));
+
+SystemView grps = 
g.context().systemView().view(CACHE_GRPS_VIEW);
+
+assertEquals(g.context().cache().cacheGroupDescriptors().size(), 
F.size(grps.iterator()));
+
+for (CacheGroupView row : grps)
+grpNames.remove(row.cacheGroupName());
+
+assertTrue(grpNames.toString(), grpNames.isEmpty());
+}
+}
+
+/** Tests work of {@link SystemView} for services. */
+@Test
+public void testServices() throws Exception {
+try (IgniteEx g = startGrid()) {
+{
+ServiceConfiguration 

[GitHub] [ignite] alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: Monitoring list engine.

2019-09-20 Thread GitBox
alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: 
Monitoring list engine.
URL: https://github.com/apache/ignite/pull/6845#discussion_r326640472
 
 

 ##
 File path: 
modules/core/src/test/java/org/apache/ignite/internal/metric/SystemViewSelfTest.java
 ##
 @@ -0,0 +1,400 @@
+/*
+ * 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.metric;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.BrokenBarrierException;
+import java.util.concurrent.CyclicBarrier;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.IgniteCompute;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.compute.ComputeJob;
+import org.apache.ignite.compute.ComputeJobResult;
+import org.apache.ignite.compute.ComputeJobResultPolicy;
+import org.apache.ignite.compute.ComputeTask;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.lang.IgniteCallable;
+import org.apache.ignite.lang.IgniteClosure;
+import org.apache.ignite.lang.IgnitePredicate;
+import org.apache.ignite.lang.IgniteRunnable;
+import org.apache.ignite.spi.systemview.view.SystemView;
+import org.apache.ignite.spi.systemview.view.CacheGroupView;
+import org.apache.ignite.spi.systemview.view.CacheView;
+import org.apache.ignite.spi.systemview.view.ComputeTaskView;
+import org.apache.ignite.spi.systemview.view.ServiceView;
+import org.apache.ignite.internal.processors.service.DummyService;
+import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.services.ServiceConfiguration;
+import org.apache.ignite.testframework.GridTestUtils;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+import org.junit.Test;
+
+import static 
org.apache.ignite.internal.processors.cache.ClusterCachesInfo.CACHES_VIEW;
+import static 
org.apache.ignite.internal.processors.cache.ClusterCachesInfo.CACHE_GRPS_VIEW;
+import static 
org.apache.ignite.internal.processors.service.IgniteServiceProcessor.SVCS_VIEW;
+import static 
org.apache.ignite.internal.processors.task.GridTaskProcessor.TASKS_VIEW;
+
+/** Tests for {@link SystemView}. */
+public class SystemViewSelfTest extends GridCommonAbstractTest {
+/** Tests work of {@link SystemView} for caches. */
+@Test
+public void testCachesView() throws Exception {
+try (IgniteEx g = startGrid()) {
+Set cacheNames = new HashSet<>(Arrays.asList("cache-1", 
"cache-2"));
+
+for (String name : cacheNames)
+g.createCache(name);
+
+SystemView caches = 
g.context().systemView().view(CACHES_VIEW);
+
+assertEquals(g.context().cache().cacheDescriptors().size(), 
F.size(caches.iterator()));
+
+for (CacheView row : caches)
+cacheNames.remove(row.cacheName());
+
+assertTrue(cacheNames.toString(), cacheNames.isEmpty());
+}
+}
+
+/** Tests work of {@link SystemView} for cache groups. */
+@Test
+public void testCacheGroupsView() throws Exception {
+try (IgniteEx g = startGrid()) {
+Set grpNames = new HashSet<>(Arrays.asList("grp-1", 
"grp-2"));
+
+for (String grpName : grpNames)
+g.createCache(new CacheConfiguration<>("cache-" + 
grpName).setGroupName(grpName));
+
+SystemView grps = 
g.context().systemView().view(CACHE_GRPS_VIEW);
+
+assertEquals(g.context().cache().cacheGroupDescriptors().size(), 
F.size(grps.iterator()));
+
+for (CacheGroupView row : grps)
+grpNames.remove(row.cacheGroupName());
+
+assertTrue(grpNames.toString(), grpNames.isEmpty());
+}
+}
+
+/** Tests work of {@link SystemView} for services. */
+@Test
+public void testServices() throws Exception {
+try (IgniteEx g = startGrid()) {
+{
+ServiceConfiguration 

[GitHub] [ignite] alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: Monitoring list engine.

2019-09-20 Thread GitBox
alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: 
Monitoring list engine.
URL: https://github.com/apache/ignite/pull/6845#discussion_r326637515
 
 

 ##
 File path: 
modules/core/src/main/java/org/apache/ignite/spi/systemview/view/ServiceView.java
 ##
 @@ -0,0 +1,98 @@
+/*
+ * 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.spi.systemview.view;
+
+import java.util.UUID;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.internal.managers.systemview.walker.Order;
+import org.apache.ignite.internal.processors.service.ServiceInfo;
+import org.apache.ignite.lang.IgnitePredicate;
+import org.apache.ignite.lang.IgniteUuid;
+
+/**
+ * Service representation for a {@link SystemView}.
+ */
+public class ServiceView {
+private final ServiceInfo serviceInfo;
+
+public ServiceView(ServiceInfo serviceInfo) {
 
 Review comment:
   JavaDoc


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [ignite] alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: Monitoring list engine.

2019-09-20 Thread GitBox
alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: 
Monitoring list engine.
URL: https://github.com/apache/ignite/pull/6845#discussion_r326637439
 
 

 ##
 File path: 
modules/core/src/main/java/org/apache/ignite/spi/systemview/view/ServiceView.java
 ##
 @@ -0,0 +1,98 @@
+/*
+ * 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.spi.systemview.view;
+
+import java.util.UUID;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.internal.managers.systemview.walker.Order;
+import org.apache.ignite.internal.processors.service.ServiceInfo;
+import org.apache.ignite.lang.IgnitePredicate;
+import org.apache.ignite.lang.IgniteUuid;
+
+/**
+ * Service representation for a {@link SystemView}.
+ */
+public class ServiceView {
+private final ServiceInfo serviceInfo;
 
 Review comment:
   JavaDoc


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [ignite] alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: Monitoring list engine.

2019-09-20 Thread GitBox
alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: 
Monitoring list engine.
URL: https://github.com/apache/ignite/pull/6845#discussion_r326637096
 
 

 ##
 File path: 
modules/core/src/main/java/org/apache/ignite/spi/systemview/view/ServiceView.java
 ##
 @@ -0,0 +1,98 @@
+/*
+ * 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.spi.systemview.view;
+
+import java.util.UUID;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.internal.managers.systemview.walker.Order;
+import org.apache.ignite.internal.processors.service.ServiceInfo;
+import org.apache.ignite.lang.IgnitePredicate;
+import org.apache.ignite.lang.IgniteUuid;
+
+/**
+ * Service representation for a {@link SystemView}.
+ */
+public class ServiceView {
+private final ServiceInfo serviceInfo;
+
+public ServiceView(ServiceInfo serviceInfo) {
+this.serviceInfo = serviceInfo;
+}
+
+/** @return Service name. */
+@Order(1)
+public String name() {
+return serviceInfo.name();
+}
+
+/** @return Service id. */
+@Order
+public IgniteUuid serviceId() {
+return serviceInfo.serviceId();
+}
+
+/** @return Service class. */
+@Order(2)
+public Class serviceClass() {
+return serviceInfo.serviceClass();
+}
+
+/** @return Total count of service instances. */
+@Order(5)
+public int totalCount() {
+return serviceInfo.totalCount();
+}
+
+/** @return Maximum instance count per node. */
+@Order(6)
+public int maxPerNodeCount() {
+return serviceInfo.maxPerNodeCount();
+}
+
+/** @return Cache name. */
+@Order(3)
+public String cacheName() {
+return serviceInfo.cacheName();
+}
+
+/** @return Affininty key value. */
+public String affinityKey() {
+Object affKey = serviceInfo.configuration().getAffinityKey();
+
+return affKey == null ? null : affKey.toString();
+
 
 Review comment:
   Redundant NL


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [ignite] alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: Monitoring list engine.

2019-09-20 Thread GitBox
alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: 
Monitoring list engine.
URL: https://github.com/apache/ignite/pull/6845#discussion_r326628997
 
 

 ##
 File path: 
modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java
 ##
 @@ -2347,14 +2353,36 @@ public IgniteConfiguration 
setMetricExporterSpi(MetricExporterSpi... metricExpor
 }
 
 /**
- * Gets fully configured monitoring SPI implementations.
+ * Sets fully configured instances of {@link SystemViewExporterSpi}.
+ *
+ * @param sysViewExporterSpi Fully configured instances of {@link 
SystemViewExporterSpi}.
+ * @return {@code this} for chaining.
+ * @see IgniteConfiguration#getSystemViewExporterSpi()
+ */
+public IgniteConfiguration 
setSystemViewExporterSpi(SystemViewExporterSpi... sysViewExporterSpi) {
+this.sysViewExporterSpi = sysViewExporterSpi;
+
+return this;
+}
+
+/**
+ * Gets fully configured metric SPI implementations.
  *
  * @return Metric exporter SPI implementations.
  */
 public MetricExporterSpi[] getMetricExporterSpi() {
 return metricExporterSpi;
 }
 
+/**
+ * Gets fully configured system view SPI implementations.
+ *
+ * @return Metric exporter SPI implementations.
 
 Review comment:
   "System view exporter SPI ..."


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [ignite] alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: Monitoring list engine.

2019-09-20 Thread GitBox
alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: 
Monitoring list engine.
URL: https://github.com/apache/ignite/pull/6845#discussion_r326627920
 
 

 ##
 File path: 
modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java
 ##
 @@ -78,6 +78,8 @@
 import org.apache.ignite.spi.loadbalancing.LoadBalancingSpi;
 import 
org.apache.ignite.spi.loadbalancing.roundrobin.RoundRobinLoadBalancingSpi;
 import org.apache.ignite.spi.metric.MetricExporterSpi;
+import org.apache.ignite.spi.systemview.SystemViewExporterSpi;
+import org.apache.ignite.spi.systemview.jmx.JmxSystemViewExporterSpi;
 
 Review comment:
   Unused import


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [ignite] alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: Monitoring list engine.

2019-09-17 Thread GitBox
alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: 
Monitoring list engine.
URL: https://github.com/apache/ignite/pull/6845#discussion_r325250197
 
 

 ##
 File path: 
modules/core/src/main/java/org/apache/ignite/internal/processors/metric/GridMetricManager.java
 ##
 @@ -268,53 +338,69 @@ public MetricRegistry registry(String name) {
 return registries.computeIfAbsent(name, n -> {
 MetricRegistry mreg = new MetricRegistry(name, log);
 
-notifyListeners(mreg, metricRegCreationLsnrs);
+notifyListeners(mreg, metricRegCreationLsnrs, log);
 
 return mreg;
 });
 }
 
-/** {@inheritDoc} */
-@NotNull @Override public Iterator iterator() {
-return registries.values().iterator();
-}
+/**
+ * Registers view which exports {@link Collection} content.
+ *
+ * @param name Name.
+ * @param desc Description.
+ * @param rowCls Row class.
+ * @param data Data.
+ * @param rowFunc value to row function.
+ * @param  List row type.
 
 Review comment:
   List -> view


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [ignite] alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: Monitoring list engine.

2019-09-17 Thread GitBox
alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: 
Monitoring list engine.
URL: https://github.com/apache/ignite/pull/6845#discussion_r325250017
 
 

 ##
 File path: 
modules/core/src/main/java/org/apache/ignite/spi/metric/ReadOnlySystemViewRegistry.java
 ##
 @@ -0,0 +1,38 @@
+/*
+ * 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.spi.metric;
+
+import java.util.function.Consumer;
+import org.apache.ignite.internal.processors.metric.GridMetricManager;
+import org.apache.ignite.spi.metric.view.SystemView;
+
+/**
+ * Read only system view registry.
+ *
+ * @see GridMetricManager
+ * @see SystemView
+ * @see MetricExporterSpi
+ */
+public interface ReadOnlySystemViewRegistry extends Iterable> {
+/**
+ * Adds listener of list creation events.
 
 Review comment:
   list -> view


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [ignite] alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: Monitoring list engine.

2019-09-17 Thread GitBox
alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: 
Monitoring list engine.
URL: https://github.com/apache/ignite/pull/6845#discussion_r325248288
 
 

 ##
 File path: 
modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcMetadataSelfTest.java
 ##
 @@ -320,10 +319,8 @@ public void testGetTableTypes() throws Exception {
  */
 @Test
 public void testGetAllView() throws Exception {
-List expViews = Arrays.asList(
+Set expViews = new HashSet<>(Arrays.asList(
 "BASELINE_NODES",
-"CACHES",
-"CACHE_GROUPS",
 
 Review comment:
   Wouldn't it be better to have enabled system view by default? To enable 
views admin must restart the node, sometimes it's not a good issue.


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [ignite] alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: Monitoring list engine.

2019-09-17 Thread GitBox
alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: 
Monitoring list engine.
URL: https://github.com/apache/ignite/pull/6845#discussion_r325244657
 
 

 ##
 File path: 
modules/core/src/main/java/org/apache/ignite/internal/cluster/ClusterGroupAdapter.java
 ##
 @@ -805,7 +805,7 @@ private CachesFilter(String cacheName, boolean affNodes, 
boolean nearNodes, bool
 
 /**
  */
-private static class AttributeFilter implements 
IgnitePredicate {
+public static class AttributeFilter implements 
IgnitePredicate {
 
 Review comment:
   I think we can (optionally) set custom node filter in a test and left this 
class private.


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [ignite] alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: Monitoring list engine.

2019-09-17 Thread GitBox
alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: 
Monitoring list engine.
URL: https://github.com/apache/ignite/pull/6845#discussion_r325246134
 
 

 ##
 File path: 
modules/core/src/test/java/org/apache/ignite/internal/metric/JmxMetricExporterSpiTest.java
 ##
 @@ -144,4 +196,129 @@ public void testFilterAndExport() throws Exception {
 
 assertEquals(44L, bean2.getAttribute("test3"));
 }
+
+/** */
+@Test
+public void testCachesView() throws Exception {
+Set cacheNames = new HashSet<>(Arrays.asList("cache-1", 
"cache-2"));
+
+for (String name : cacheNames)
+ignite.createCache(name);
+
+TabularDataSupport data = systemView(CACHES_VIEW);
+
+assertEquals(ignite.context().cache().cacheDescriptors().size(), 
data.size());
+
+for (int i = 0; i < data.size(); i++) {
+CompositeData row = data.get(new Object[] {i});
+
+cacheNames.remove(row.get("cacheName"));
+}
+
+assertTrue(cacheNames.toString(), cacheNames.isEmpty());
+}
+
+/** */
+@Test
+public void testCacheGroupsView() throws Exception {
+Set grpNames = new HashSet<>(Arrays.asList("grp-1", "grp-2"));
+
+for (String grpName : grpNames)
+ignite.createCache(new CacheConfiguration<>("cache-" + 
grpName).setGroupName(grpName));
+
+TabularDataSupport grps = systemView(CACHE_GRPS_VIEW);
+
+assertEquals(ignite.context().cache().cacheGroupDescriptors().size(), 
grps.size());
+
+for (Map.Entry entry : grps.entrySet()) {
+CompositeData row = (CompositeData)entry.getValue();
+
+grpNames.remove(row.get("cacheGroupName"));
+}
+
+assertTrue(grpNames.toString(), grpNames.isEmpty());
+}
+
+/** */
+@Test
+public void testServices() throws Exception {
+ServiceConfiguration srvcCfg = new ServiceConfiguration();
+
+srvcCfg.setName("service");
+srvcCfg.setMaxPerNodeCount(1);
+srvcCfg.setService(new DummyService());
+
+ignite.services().deploy(srvcCfg);
+
+TabularDataSupport srvs = systemView(SVCS_VIEW);
+
+assertEquals(ignite.context().service().serviceDescriptors().size(), 
srvs.size());
+
+CompositeData sysView = srvs.get(new Object[] {0});
+
+assertEquals(srvcCfg.getName(), sysView.get("name"));
+assertEquals(srvcCfg.getMaxPerNodeCount(), 
sysView.get("maxPerNodeCount"));
+assertEquals(DummyService.class.getName(), 
sysView.get("serviceClass"));
+}
+
+/** */
+@Test
+public void testComputeBroadcast() throws Exception {
+latch = new CountDownLatch(1);
+
+for (int i = 0; i < 5; i++) {
+ignite.compute().broadcastAsync(() -> {
+try {
+latch.await();
+}
+catch (InterruptedException e) {
+throw new RuntimeException(e);
+}
+});
+}
+
+TabularDataSupport tasks = systemView(TASKS_VIEW);
+
+assertEquals(5, tasks.size());
 
 Review comment:
   Perhaps we can get flaky failure here, I think it's better to use 
`CyclicBarrier` instead of the latch (before checks and after checks).


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [ignite] alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: Monitoring list engine.

2019-09-17 Thread GitBox
alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: 
Monitoring list engine.
URL: https://github.com/apache/ignite/pull/6845#discussion_r325225758
 
 

 ##
 File path: 
modules/core/src/main/java/org/apache/ignite/spi/metric/jmx/JmxMetricExporterSpi.java
 ##
 @@ -31,41 +32,99 @@
 import org.apache.ignite.spi.IgniteSpiException;
 import org.apache.ignite.spi.metric.MetricExporterSpi;
 import org.apache.ignite.spi.metric.ReadOnlyMetricRegistry;
+import org.apache.ignite.spi.metric.ReadOnlySystemViewRegistry;
+import org.apache.ignite.spi.metric.view.SystemView;
 import org.jetbrains.annotations.Nullable;
 
 import static 
org.apache.ignite.internal.processors.metric.impl.MetricUtils.parse;
+import static org.apache.ignite.internal.util.IgniteUtils.makeMBeanName;
+import static org.apache.ignite.spi.metric.jmx.SystemViewMBean.VIEWS;
 
 /**
  * This SPI implementation exports metrics as JMX beans.
  */
 public class JmxMetricExporterSpi extends IgniteSpiAdapter implements 
MetricExporterSpi {
-/** Monitoring registry. */
+/** Metric registry. */
 private ReadOnlyMetricRegistry mreg;
 
+/** Syste view registry. */
+private ReadOnlySystemViewRegistry mlreg;
+
 /** Metric filter. */
-private @Nullable Predicate filter;
+private @Nullable Predicate metricFilter;
+
+/** System view filter. */
+private @Nullable Predicate> systeViewFilter;
 
 Review comment:
   syste**m**ViewFilter


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [ignite] alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: Monitoring list engine.

2019-09-16 Thread GitBox
alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: 
Monitoring list engine.
URL: https://github.com/apache/ignite/pull/6845#discussion_r324734102
 
 

 ##
 File path: 
modules/core/src/test/java/org/apache/ignite/internal/metric/SystemViewSelfTest.java
 ##
 @@ -0,0 +1,144 @@
+/*
+ * 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.metric;
+
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
+import java.util.concurrent.CountDownLatch;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.spi.metric.view.SystemView;
+import org.apache.ignite.spi.metric.view.CacheGroupView;
+import org.apache.ignite.spi.metric.view.CacheView;
+import org.apache.ignite.spi.metric.view.ComputeTaskView;
+import org.apache.ignite.spi.metric.view.ServiceView;
+import org.apache.ignite.internal.processors.service.DummyService;
+import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.services.ServiceConfiguration;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.junit.Test;
+
+import static 
org.apache.ignite.internal.processors.cache.ClusterCachesInfo.CACHES_VIEW;
+import static 
org.apache.ignite.internal.processors.cache.ClusterCachesInfo.CACHE_GRPS_VIEW;
+import static 
org.apache.ignite.internal.processors.service.IgniteServiceProcessor.SVCS_VIEW;
+import static 
org.apache.ignite.internal.processors.task.GridTaskProcessor.TASKS_VIEW;
+
+/** */
+public class SystemViewSelfTest extends GridCommonAbstractTest {
+/** */
+private static CountDownLatch latch;
+
+/** */
+@Test
+public void testCachesView() throws Exception {
+try (IgniteEx g = startGrid()) {
+Set cacheNames = new HashSet<>(Arrays.asList("cache-1", 
"cache-2"));
+
+for (String name : cacheNames)
+g.createCache(name);
+
+SystemView caches = 
g.context().metric().view(CACHES_VIEW);
+
+assertEquals(g.context().cache().cacheDescriptors().size(), 
F.size(caches.iterator()));
+
+for (CacheView row : caches)
+cacheNames.remove(row.cacheName());
+
+assertTrue(cacheNames.toString(), cacheNames.isEmpty());
+}
+}
+
+/** */
+@Test
+public void testCacheGroupsView() throws Exception {
+try(IgniteEx g = startGrid()) {
+Set grpNames = new HashSet<>(Arrays.asList("grp-1", 
"grp-2"));
+
+for (String grpName : grpNames)
+g.createCache(new CacheConfiguration<>("cache-" + 
grpName).setGroupName(grpName));
+
+SystemView grps = 
g.context().metric().view(CACHE_GRPS_VIEW);
+
+assertEquals(g.context().cache().cacheGroupDescriptors().size(), 
F.size(grps.iterator()));
+
+for (CacheGroupView row : grps)
+grpNames.remove(row.cacheGroupName());
+
+assertTrue(grpNames.toString(), grpNames.isEmpty());
+}
+}
+
+/** */
+@Test
+public void testServices() throws Exception {
+try(IgniteEx g = startGrid()) {
+ServiceConfiguration srvcCfg = new ServiceConfiguration();
+
+srvcCfg.setName("service");
+srvcCfg.setMaxPerNodeCount(1);
+srvcCfg.setService(new DummyService());
+
+g.services().deploy(srvcCfg);
+
+SystemView srvs = 
g.context().metric().view(SVCS_VIEW);
+
+assertEquals(g.context().service().serviceDescriptors().size(), 
F.size(srvs.iterator()));
+
+ServiceView sview = srvs.iterator().next();
+
+assertEquals(srvcCfg.getName(), sview.name());
+assertEquals(srvcCfg.getMaxPerNodeCount(), 
sview.maxPerNodeCount());
+assertEquals(DummyService.class, sview.serviceClass());
+}
+}
+
+/** */
+@Test
+public void testComputeBroadcast() throws Exception {
 
 Review comment:
   I think we should cover more cases for tasks (for example run tasks by 
name/by class/by closure, run tasks from another node), to see different values 
for different rows in one column of the list. The 

[GitHub] [ignite] alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: Monitoring list engine.

2019-09-16 Thread GitBox
alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: 
Monitoring list engine.
URL: https://github.com/apache/ignite/pull/6845#discussion_r324731050
 
 

 ##
 File path: 
modules/core/src/test/java/org/apache/ignite/internal/metric/SystemViewSelfTest.java
 ##
 @@ -0,0 +1,144 @@
+/*
+ * 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.metric;
+
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
+import java.util.concurrent.CountDownLatch;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.spi.metric.view.SystemView;
+import org.apache.ignite.spi.metric.view.CacheGroupView;
+import org.apache.ignite.spi.metric.view.CacheView;
+import org.apache.ignite.spi.metric.view.ComputeTaskView;
+import org.apache.ignite.spi.metric.view.ServiceView;
+import org.apache.ignite.internal.processors.service.DummyService;
+import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.services.ServiceConfiguration;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.junit.Test;
+
+import static 
org.apache.ignite.internal.processors.cache.ClusterCachesInfo.CACHES_VIEW;
+import static 
org.apache.ignite.internal.processors.cache.ClusterCachesInfo.CACHE_GRPS_VIEW;
+import static 
org.apache.ignite.internal.processors.service.IgniteServiceProcessor.SVCS_VIEW;
+import static 
org.apache.ignite.internal.processors.task.GridTaskProcessor.TASKS_VIEW;
+
+/** */
+public class SystemViewSelfTest extends GridCommonAbstractTest {
+/** */
+private static CountDownLatch latch;
+
+/** */
+@Test
+public void testCachesView() throws Exception {
+try (IgniteEx g = startGrid()) {
+Set cacheNames = new HashSet<>(Arrays.asList("cache-1", 
"cache-2"));
+
+for (String name : cacheNames)
+g.createCache(name);
+
+SystemView caches = 
g.context().metric().view(CACHES_VIEW);
+
+assertEquals(g.context().cache().cacheDescriptors().size(), 
F.size(caches.iterator()));
+
+for (CacheView row : caches)
+cacheNames.remove(row.cacheName());
+
+assertTrue(cacheNames.toString(), cacheNames.isEmpty());
+}
+}
+
+/** */
+@Test
+public void testCacheGroupsView() throws Exception {
+try(IgniteEx g = startGrid()) {
+Set grpNames = new HashSet<>(Arrays.asList("grp-1", 
"grp-2"));
+
+for (String grpName : grpNames)
+g.createCache(new CacheConfiguration<>("cache-" + 
grpName).setGroupName(grpName));
+
+SystemView grps = 
g.context().metric().view(CACHE_GRPS_VIEW);
+
+assertEquals(g.context().cache().cacheGroupDescriptors().size(), 
F.size(grps.iterator()));
+
+for (CacheGroupView row : grps)
+grpNames.remove(row.cacheGroupName());
+
+assertTrue(grpNames.toString(), grpNames.isEmpty());
+}
+}
+
+/** */
+@Test
+public void testServices() throws Exception {
+try(IgniteEx g = startGrid()) {
+ServiceConfiguration srvcCfg = new ServiceConfiguration();
+
+srvcCfg.setName("service");
+srvcCfg.setMaxPerNodeCount(1);
+srvcCfg.setService(new DummyService());
+
+g.services().deploy(srvcCfg);
+
+SystemView srvs = 
g.context().metric().view(SVCS_VIEW);
+
+assertEquals(g.context().service().serviceDescriptors().size(), 
F.size(srvs.iterator()));
+
+ServiceView sview = srvs.iterator().next();
+
+assertEquals(srvcCfg.getName(), sview.name());
+assertEquals(srvcCfg.getMaxPerNodeCount(), 
sview.maxPerNodeCount());
+assertEquals(DummyService.class, sview.serviceClass());
+}
+}
+
+/** */
+@Test
+public void testComputeBroadcast() throws Exception {
+latch = new CountDownLatch(1);
+
+try(IgniteEx g1 = startGrid(0)) {
+SystemView tasks = 
g1.context().metric().view(TASKS_VIEW);
+
+for (int i=0; i<5; i++)
 
 Review comment:
   Spaces 

[GitHub] [ignite] alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: Monitoring list engine.

2019-09-16 Thread GitBox
alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: 
Monitoring list engine.
URL: https://github.com/apache/ignite/pull/6845#discussion_r324730783
 
 

 ##
 File path: 
modules/core/src/test/java/org/apache/ignite/internal/metric/SystemViewSelfTest.java
 ##
 @@ -0,0 +1,144 @@
+/*
+ * 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.metric;
+
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
+import java.util.concurrent.CountDownLatch;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.spi.metric.view.SystemView;
+import org.apache.ignite.spi.metric.view.CacheGroupView;
+import org.apache.ignite.spi.metric.view.CacheView;
+import org.apache.ignite.spi.metric.view.ComputeTaskView;
+import org.apache.ignite.spi.metric.view.ServiceView;
+import org.apache.ignite.internal.processors.service.DummyService;
+import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.services.ServiceConfiguration;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.junit.Test;
+
+import static 
org.apache.ignite.internal.processors.cache.ClusterCachesInfo.CACHES_VIEW;
+import static 
org.apache.ignite.internal.processors.cache.ClusterCachesInfo.CACHE_GRPS_VIEW;
+import static 
org.apache.ignite.internal.processors.service.IgniteServiceProcessor.SVCS_VIEW;
+import static 
org.apache.ignite.internal.processors.task.GridTaskProcessor.TASKS_VIEW;
+
+/** */
+public class SystemViewSelfTest extends GridCommonAbstractTest {
+/** */
+private static CountDownLatch latch;
+
+/** */
+@Test
+public void testCachesView() throws Exception {
+try (IgniteEx g = startGrid()) {
+Set cacheNames = new HashSet<>(Arrays.asList("cache-1", 
"cache-2"));
+
+for (String name : cacheNames)
+g.createCache(name);
+
+SystemView caches = 
g.context().metric().view(CACHES_VIEW);
+
+assertEquals(g.context().cache().cacheDescriptors().size(), 
F.size(caches.iterator()));
+
+for (CacheView row : caches)
+cacheNames.remove(row.cacheName());
+
+assertTrue(cacheNames.toString(), cacheNames.isEmpty());
+}
+}
+
+/** */
+@Test
+public void testCacheGroupsView() throws Exception {
+try(IgniteEx g = startGrid()) {
+Set grpNames = new HashSet<>(Arrays.asList("grp-1", 
"grp-2"));
+
+for (String grpName : grpNames)
+g.createCache(new CacheConfiguration<>("cache-" + 
grpName).setGroupName(grpName));
+
+SystemView grps = 
g.context().metric().view(CACHE_GRPS_VIEW);
+
+assertEquals(g.context().cache().cacheGroupDescriptors().size(), 
F.size(grps.iterator()));
+
+for (CacheGroupView row : grps)
+grpNames.remove(row.cacheGroupName());
+
+assertTrue(grpNames.toString(), grpNames.isEmpty());
+}
+}
+
+/** */
+@Test
+public void testServices() throws Exception {
+try(IgniteEx g = startGrid()) {
+ServiceConfiguration srvcCfg = new ServiceConfiguration();
+
+srvcCfg.setName("service");
+srvcCfg.setMaxPerNodeCount(1);
+srvcCfg.setService(new DummyService());
+
+g.services().deploy(srvcCfg);
+
+SystemView srvs = 
g.context().metric().view(SVCS_VIEW);
+
+assertEquals(g.context().service().serviceDescriptors().size(), 
F.size(srvs.iterator()));
+
+ServiceView sview = srvs.iterator().next();
+
+assertEquals(srvcCfg.getName(), sview.name());
+assertEquals(srvcCfg.getMaxPerNodeCount(), 
sview.maxPerNodeCount());
+assertEquals(DummyService.class, sview.serviceClass());
+}
+}
+
+/** */
+@Test
+public void testComputeBroadcast() throws Exception {
+latch = new CountDownLatch(1);
+
+try(IgniteEx g1 = startGrid(0)) {
 
 Review comment:
   Space missed


This is an automated message from the 

[GitHub] [ignite] alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: Monitoring list engine.

2019-09-13 Thread GitBox
alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: 
Monitoring list engine.
URL: https://github.com/apache/ignite/pull/6845#discussion_r324151337
 
 

 ##
 File path: 
modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/SqlSystemViewsSelfTest.java
 ##
 @@ -1293,7 +1302,7 @@ public void testCachesViews() throws Exception {
 assertEquals(0L, execSql("SELECT COUNT(*) FROM " + systemSchemaName() 
+ ".CACHES WHERE CACHE_NAME = 'no_such_cache'").get(0)
 .get(0));
 
-assertEquals(0L, execSql("SELECT COUNT(*) FROM " + systemSchemaName() 
+ ".CACHES WHERE CACHE_NAME = 1").get(0).get(0));
+//assertEquals(0L, execSql("SELECT COUNT(*) FROM " + 
systemSchemaName() + ".CACHES WHERE CACHE_NAME = 1").get(0).get(0));
 
 Review comment:
   It's not an error, it was made on purpose to cover case that comparison with 
wrong data type doesn't break the view, SQL should return an empty result set 
instead.


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [ignite] alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: Monitoring list engine.

2019-09-13 Thread GitBox
alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: 
Monitoring list engine.
URL: https://github.com/apache/ignite/pull/6845#discussion_r324116393
 
 

 ##
 File path: 
modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/SqlSystemViewsSelfTest.java
 ##
 @@ -1293,7 +1302,7 @@ public void testCachesViews() throws Exception {
 assertEquals(0L, execSql("SELECT COUNT(*) FROM " + systemSchemaName() 
+ ".CACHES WHERE CACHE_NAME = 'no_such_cache'").get(0)
 .get(0));
 
-assertEquals(0L, execSql("SELECT COUNT(*) FROM " + systemSchemaName() 
+ ".CACHES WHERE CACHE_NAME = 1").get(0).get(0));
+//assertEquals(0L, execSql("SELECT COUNT(*) FROM " + 
systemSchemaName() + ".CACHES WHERE CACHE_NAME = 1").get(0).get(0));
 
 Review comment:
   Why this line is commented?


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [ignite] alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: Monitoring list engine.

2019-09-13 Thread GitBox
alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: 
Monitoring list engine.
URL: https://github.com/apache/ignite/pull/6845#discussion_r324107703
 
 

 ##
 File path: 
modules/core/src/test/java/org/apache/ignite/internal/metric/JmxMetricExporterSpiTest.java
 ##
 @@ -144,4 +210,125 @@ public void testFilterAndExport() throws Exception {
 
 assertEquals(44L, bean2.getAttribute("test3"));
 }
+
+/** */
+@Test
+public void testCachesList() throws Exception {
+Set cacheNames = new HashSet<>(Arrays.asList("cache-1", 
"cache-2"));
+
+for (String name : cacheNames)
+ignite.createCache(name);
+
+TabularDataSupport data = monitoringList("caches");
+
+assertEquals(3, data.size());
+
+for(int i=0; i grpNames = new HashSet<>(Arrays.asList("grp-1", "grp-2"));
+
+for (String grpName : grpNames)
+ignite.createCache(new CacheConfiguration<>("cache-" + 
grpName).setGroupName(grpName));
+
+TabularDataSupport grps = monitoringList("cacheGroups");
+
+assertEquals("ignite-sys, grp-1, grp-2", 3, grps.size());
+
+for (Map.Entry entry : grps.entrySet()) {
+CompositeData row = (CompositeData)entry.getValue();
+
+grpNames.remove(row.get("cacheGroupName"));
+}
+
+assertTrue(grpNames.toString(), grpNames.isEmpty());
+}
+
+/** */
+@Test
+public void testServices() throws Exception {
+ServiceConfiguration srvcCfg = new ServiceConfiguration();
+
+srvcCfg.setName("service");
+srvcCfg.setMaxPerNodeCount(1);
+srvcCfg.setService(new DummyService());
+
+ignite.services().deploy(srvcCfg);
+
+TabularDataSupport srvs = monitoringList("services");
+
+assertEquals(1, srvs.size());
+
+CompositeData sview = srvs.get(new Object[] {0});
+
+assertEquals(srvcCfg.getName(), sview.get("name"));
+assertEquals(srvcCfg.getMaxPerNodeCount(), 
sview.get("maxPerNodeCount"));
+assertEquals(DummyService.class.getName(), sview.get("serviceClass"));
+}
+
+/** */
+@Test
+public void testComputeBroadcast() throws Exception {
+for (int i = 0; i < 5; i++) {
+ignite.compute().broadcastAsync(() -> {
+try {
+Thread.sleep(3_000L);
 
 Review comment:
   Please use some synchronizer, but not `sleep()`.
   Also, you need synchronization before checking the list. I think 
`CyclicBarrier` will be helpful here, which can be used twice.


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [ignite] alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: Monitoring list engine.

2019-09-13 Thread GitBox
alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: 
Monitoring list engine.
URL: https://github.com/apache/ignite/pull/6845#discussion_r324107703
 
 

 ##
 File path: 
modules/core/src/test/java/org/apache/ignite/internal/metric/JmxMetricExporterSpiTest.java
 ##
 @@ -144,4 +210,125 @@ public void testFilterAndExport() throws Exception {
 
 assertEquals(44L, bean2.getAttribute("test3"));
 }
+
+/** */
+@Test
+public void testCachesList() throws Exception {
+Set cacheNames = new HashSet<>(Arrays.asList("cache-1", 
"cache-2"));
+
+for (String name : cacheNames)
+ignite.createCache(name);
+
+TabularDataSupport data = monitoringList("caches");
+
+assertEquals(3, data.size());
+
+for(int i=0; i grpNames = new HashSet<>(Arrays.asList("grp-1", "grp-2"));
+
+for (String grpName : grpNames)
+ignite.createCache(new CacheConfiguration<>("cache-" + 
grpName).setGroupName(grpName));
+
+TabularDataSupport grps = monitoringList("cacheGroups");
+
+assertEquals("ignite-sys, grp-1, grp-2", 3, grps.size());
+
+for (Map.Entry entry : grps.entrySet()) {
+CompositeData row = (CompositeData)entry.getValue();
+
+grpNames.remove(row.get("cacheGroupName"));
+}
+
+assertTrue(grpNames.toString(), grpNames.isEmpty());
+}
+
+/** */
+@Test
+public void testServices() throws Exception {
+ServiceConfiguration srvcCfg = new ServiceConfiguration();
+
+srvcCfg.setName("service");
+srvcCfg.setMaxPerNodeCount(1);
+srvcCfg.setService(new DummyService());
+
+ignite.services().deploy(srvcCfg);
+
+TabularDataSupport srvs = monitoringList("services");
+
+assertEquals(1, srvs.size());
+
+CompositeData sview = srvs.get(new Object[] {0});
+
+assertEquals(srvcCfg.getName(), sview.get("name"));
+assertEquals(srvcCfg.getMaxPerNodeCount(), 
sview.get("maxPerNodeCount"));
+assertEquals(DummyService.class.getName(), sview.get("serviceClass"));
+}
+
+/** */
+@Test
+public void testComputeBroadcast() throws Exception {
+for (int i = 0; i < 5; i++) {
+ignite.compute().broadcastAsync(() -> {
+try {
+Thread.sleep(3_000L);
 
 Review comment:
   Please use some synchronizer, but not `sleep()`.
   Also, you need synchronization before checking the list. I think 
CyclicBarrier will be helpful here, which can be used twice.


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [ignite] alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: Monitoring list engine.

2019-09-13 Thread GitBox
alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: 
Monitoring list engine.
URL: https://github.com/apache/ignite/pull/6845#discussion_r324106288
 
 

 ##
 File path: 
modules/core/src/test/java/org/apache/ignite/internal/metric/JmxMetricExporterSpiTest.java
 ##
 @@ -144,4 +210,125 @@ public void testFilterAndExport() throws Exception {
 
 assertEquals(44L, bean2.getAttribute("test3"));
 }
+
+/** */
+@Test
+public void testCachesList() throws Exception {
+Set cacheNames = new HashSet<>(Arrays.asList("cache-1", 
"cache-2"));
+
+for (String name : cacheNames)
+ignite.createCache(name);
+
+TabularDataSupport data = monitoringList("caches");
+
+assertEquals(3, data.size());
+
+for(int i=0; i grpNames = new HashSet<>(Arrays.asList("grp-1", "grp-2"));
+
+for (String grpName : grpNames)
+ignite.createCache(new CacheConfiguration<>("cache-" + 
grpName).setGroupName(grpName));
+
+TabularDataSupport grps = monitoringList("cacheGroups");
+
+assertEquals("ignite-sys, grp-1, grp-2", 3, grps.size());
+
+for (Map.Entry entry : grps.entrySet()) {
+CompositeData row = (CompositeData)entry.getValue();
+
+grpNames.remove(row.get("cacheGroupName"));
+}
+
+assertTrue(grpNames.toString(), grpNames.isEmpty());
+}
+
+/** */
+@Test
+public void testServices() throws Exception {
+ServiceConfiguration srvcCfg = new ServiceConfiguration();
+
+srvcCfg.setName("service");
+srvcCfg.setMaxPerNodeCount(1);
+srvcCfg.setService(new DummyService());
+
+ignite.services().deploy(srvcCfg);
+
+TabularDataSupport srvs = monitoringList("services");
 
 Review comment:
   `SVCS_MON_LIST`


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [ignite] alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: Monitoring list engine.

2019-09-13 Thread GitBox
alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: 
Monitoring list engine.
URL: https://github.com/apache/ignite/pull/6845#discussion_r324106414
 
 

 ##
 File path: 
modules/core/src/test/java/org/apache/ignite/internal/metric/JmxMetricExporterSpiTest.java
 ##
 @@ -144,4 +210,125 @@ public void testFilterAndExport() throws Exception {
 
 assertEquals(44L, bean2.getAttribute("test3"));
 }
+
+/** */
+@Test
+public void testCachesList() throws Exception {
+Set cacheNames = new HashSet<>(Arrays.asList("cache-1", 
"cache-2"));
+
+for (String name : cacheNames)
+ignite.createCache(name);
+
+TabularDataSupport data = monitoringList("caches");
+
+assertEquals(3, data.size());
+
+for(int i=0; i grpNames = new HashSet<>(Arrays.asList("grp-1", "grp-2"));
+
+for (String grpName : grpNames)
+ignite.createCache(new CacheConfiguration<>("cache-" + 
grpName).setGroupName(grpName));
+
+TabularDataSupport grps = monitoringList("cacheGroups");
+
+assertEquals("ignite-sys, grp-1, grp-2", 3, grps.size());
+
+for (Map.Entry entry : grps.entrySet()) {
+CompositeData row = (CompositeData)entry.getValue();
+
+grpNames.remove(row.get("cacheGroupName"));
+}
+
+assertTrue(grpNames.toString(), grpNames.isEmpty());
+}
+
+/** */
+@Test
+public void testServices() throws Exception {
+ServiceConfiguration srvcCfg = new ServiceConfiguration();
+
+srvcCfg.setName("service");
+srvcCfg.setMaxPerNodeCount(1);
+srvcCfg.setService(new DummyService());
+
+ignite.services().deploy(srvcCfg);
+
+TabularDataSupport srvs = monitoringList("services");
+
+assertEquals(1, srvs.size());
+
+CompositeData sview = srvs.get(new Object[] {0});
+
+assertEquals(srvcCfg.getName(), sview.get("name"));
+assertEquals(srvcCfg.getMaxPerNodeCount(), 
sview.get("maxPerNodeCount"));
+assertEquals(DummyService.class.getName(), sview.get("serviceClass"));
+}
+
+/** */
+@Test
+public void testComputeBroadcast() throws Exception {
+for (int i = 0; i < 5; i++) {
+ignite.compute().broadcastAsync(() -> {
+try {
+Thread.sleep(3_000L);
+}
+catch (InterruptedException e) {
+throw new RuntimeException(e);
+}
+});
+}
+
+TabularDataSupport tasks = monitoringList("tasks");
 
 Review comment:
   `TASKS_MON_LIST`


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [ignite] alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: Monitoring list engine.

2019-09-13 Thread GitBox
alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: 
Monitoring list engine.
URL: https://github.com/apache/ignite/pull/6845#discussion_r324105192
 
 

 ##
 File path: 
modules/core/src/test/java/org/apache/ignite/internal/metric/JmxMetricExporterSpiTest.java
 ##
 @@ -144,4 +210,125 @@ public void testFilterAndExport() throws Exception {
 
 assertEquals(44L, bean2.getAttribute("test3"));
 }
+
+/** */
+@Test
+public void testCachesList() throws Exception {
+Set cacheNames = new HashSet<>(Arrays.asList("cache-1", 
"cache-2"));
+
+for (String name : cacheNames)
+ignite.createCache(name);
+
+TabularDataSupport data = monitoringList("caches");
+
+assertEquals(3, data.size());
+
+for(int i=0; i grpNames = new HashSet<>(Arrays.asList("grp-1", "grp-2"));
+
+for (String grpName : grpNames)
+ignite.createCache(new CacheConfiguration<>("cache-" + 
grpName).setGroupName(grpName));
+
+TabularDataSupport grps = monitoringList("cacheGroups");
+
+assertEquals("ignite-sys, grp-1, grp-2", 3, grps.size());
 
 Review comment:
   Strange error message. "3" can be replaced with 
`ignite.context().cache().cacheGroupDescriptors().size()`


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [ignite] alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: Monitoring list engine.

2019-09-13 Thread GitBox
alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: 
Monitoring list engine.
URL: https://github.com/apache/ignite/pull/6845#discussion_r324103269
 
 

 ##
 File path: 
modules/core/src/test/java/org/apache/ignite/internal/metric/JmxMetricExporterSpiTest.java
 ##
 @@ -144,4 +210,125 @@ public void testFilterAndExport() throws Exception {
 
 assertEquals(44L, bean2.getAttribute("test3"));
 }
+
+/** */
+@Test
+public void testCachesList() throws Exception {
+Set cacheNames = new HashSet<>(Arrays.asList("cache-1", 
"cache-2"));
+
+for (String name : cacheNames)
+ignite.createCache(name);
+
+TabularDataSupport data = monitoringList("caches");
+
+assertEquals(3, data.size());
+
+for(int i=0; i grpNames = new HashSet<>(Arrays.asList("grp-1", "grp-2"));
+
+for (String grpName : grpNames)
+ignite.createCache(new CacheConfiguration<>("cache-" + 
grpName).setGroupName(grpName));
+
+TabularDataSupport grps = monitoringList("cacheGroups");
 
 Review comment:
   `GridMetricManager#CACHE_GRPS_MON_LIST`


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [ignite] alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: Monitoring list engine.

2019-09-13 Thread GitBox
alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: 
Monitoring list engine.
URL: https://github.com/apache/ignite/pull/6845#discussion_r324102973
 
 

 ##
 File path: 
modules/core/src/test/java/org/apache/ignite/internal/metric/JmxMetricExporterSpiTest.java
 ##
 @@ -144,4 +210,125 @@ public void testFilterAndExport() throws Exception {
 
 assertEquals(44L, bean2.getAttribute("test3"));
 }
+
+/** */
+@Test
+public void testCachesList() throws Exception {
+Set cacheNames = new HashSet<>(Arrays.asList("cache-1", 
"cache-2"));
+
+for (String name : cacheNames)
+ignite.createCache(name);
+
+TabularDataSupport data = monitoringList("caches");
+
+assertEquals(3, data.size());
+
+for(int i=0; i

[GitHub] [ignite] alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: Monitoring list engine.

2019-09-13 Thread GitBox
alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: 
Monitoring list engine.
URL: https://github.com/apache/ignite/pull/6845#discussion_r324102642
 
 

 ##
 File path: 
modules/core/src/test/java/org/apache/ignite/internal/metric/JmxMetricExporterSpiTest.java
 ##
 @@ -144,4 +210,125 @@ public void testFilterAndExport() throws Exception {
 
 assertEquals(44L, bean2.getAttribute("test3"));
 }
+
+/** */
+@Test
+public void testCachesList() throws Exception {
+Set cacheNames = new HashSet<>(Arrays.asList("cache-1", 
"cache-2"));
+
+for (String name : cacheNames)
+ignite.createCache(name);
+
+TabularDataSupport data = monitoringList("caches");
+
+assertEquals(3, data.size());
 
 Review comment:
   I think something like `ignite.context().cache().cacheDescriptors().size()` 
will be better then just a constant.


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [ignite] alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: Monitoring list engine.

2019-09-13 Thread GitBox
alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: 
Monitoring list engine.
URL: https://github.com/apache/ignite/pull/6845#discussion_r324100479
 
 

 ##
 File path: 
modules/core/src/test/java/org/apache/ignite/internal/metric/JmxMetricExporterSpiTest.java
 ##
 @@ -144,4 +210,125 @@ public void testFilterAndExport() throws Exception {
 
 assertEquals(44L, bean2.getAttribute("test3"));
 }
+
+/** */
+@Test
+public void testCachesList() throws Exception {
+Set cacheNames = new HashSet<>(Arrays.asList("cache-1", 
"cache-2"));
+
+for (String name : cacheNames)
+ignite.createCache(name);
+
+TabularDataSupport data = monitoringList("caches");
 
 Review comment:
   "caches" -> `GridMetricManager#CACHES_MON_LIST`


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [ignite] alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: Monitoring list engine.

2019-09-12 Thread GitBox
alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: 
Monitoring list engine.
URL: https://github.com/apache/ignite/pull/6845#discussion_r323750481
 
 

 ##
 File path: 
modules/core/src/main/java/org/apache/ignite/spi/metric/list/MonitoringRowAttributeWalker.java
 ##
 @@ -0,0 +1,204 @@
+/*
+ * 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.spi.metric.list;
+
+/**
+ * Utility class for quick iteration over {@link MonitoringRow} properties.
+ */
+public interface MonitoringRowAttributeWalker {
+/** @return Count of a row properties. */
+public int count();
+
+/**
+ * Calls visitor for each {@link MonitoringRow} attribute.
+ *
+ * @param visitor Attribute visitor.
+ */
+public void visitAll(AttributeVisitor visitor);
+
+/**
+ * Calls visitor for each {@link MonitoringRow} attribute.
+ * Value of the attribute also provided.
+ *
+ * @param row Row to iterate.
+ * @param visitor Attribute visitor.
+ */
+public void visitAll(R row, AttributeWithValueVisitor visitor);
+
+/** Attribute visitor. */
+public interface AttributeVisitor {
+/**
+ * Visit some object property.
+ * @param idx Index.
+ * @param name Name.
+ * @param clazz Value class.
+ * @param  Value type.
+ */
+public  void accept(int idx, String name, Class clazz);
+
+/**
+ * Visit attribute. Attribute value is {@code boolean} primitive.
+ *
+ * @param idx Index.
+ * @param name Name.
+ */
+public void acceptBoolean(int idx, String name);
 
 Review comment:
   How we simplify the code with several accept* methods? I see only 
duplication in 3 exporters implementations. And not sure about more quick code. 
We only saving some `if` branch checks for list headers generation. I think 
it's absolutely nothing.


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [ignite] alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: Monitoring list engine.

2019-09-12 Thread GitBox
alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: 
Monitoring list engine.
URL: https://github.com/apache/ignite/pull/6845#discussion_r323734169
 
 

 ##
 File path: 
modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheComparatorTest.java
 ##
 @@ -42,10 +42,8 @@ public void testDirect() {
 null, true, null, true,
 false, null, new QuerySchema(), null);
 
-assertEquals(-1,
-ClusterCachesInfo.CacheComparators.DIRECT.compare(desc1, desc2));
+assertTrue(ClusterCachesInfo.CacheComparators.DIRECT.compare(desc1, 
desc2) < 0);
 
 Review comment:
   After `compare` method was fixed this change is redundant.


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [ignite] alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: Monitoring list engine.

2019-09-12 Thread GitBox
alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: 
Monitoring list engine.
URL: https://github.com/apache/ignite/pull/6845#discussion_r323729706
 
 

 ##
 File path: 
modules/core/src/main/java/org/apache/ignite/spi/metric/list/MonitoringRowAttributeWalker.java
 ##
 @@ -0,0 +1,204 @@
+/*
+ * 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.spi.metric.list;
+
+/**
+ * Utility class for quick iteration over {@link MonitoringRow} properties.
+ */
+public interface MonitoringRowAttributeWalker {
+/** @return Count of a row properties. */
+public int count();
+
+/**
+ * Calls visitor for each {@link MonitoringRow} attribute.
+ *
+ * @param visitor Attribute visitor.
+ */
+public void visitAll(AttributeVisitor visitor);
+
+/**
+ * Calls visitor for each {@link MonitoringRow} attribute.
+ * Value of the attribute also provided.
+ *
+ * @param row Row to iterate.
+ * @param visitor Attribute visitor.
+ */
+public void visitAll(R row, AttributeWithValueVisitor visitor);
+
+/** Attribute visitor. */
+public interface AttributeVisitor {
+/**
+ * Visit some object property.
+ * @param idx Index.
+ * @param name Name.
+ * @param clazz Value class.
+ * @param  Value type.
+ */
+public  void accept(int idx, String name, Class clazz);
+
+/**
+ * Visit attribute. Attribute value is {@code boolean} primitive.
+ *
+ * @param idx Index.
+ * @param name Name.
+ */
+public void acceptBoolean(int idx, String name);
 
 Review comment:
   Do we really need all these `accept*` methods? Can we reuse `accept(idx, 
name, clazz)` method?
   In `AttributeWithValueVisitor` this methods helps to avoid boxing, but in 
`AttributeVisitor` no value passed to methods, so reuse of `accept()` will 
simplify the code.


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [ignite] alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: Monitoring list engine.

2019-09-12 Thread GitBox
alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: 
Monitoring list engine.
URL: https://github.com/apache/ignite/pull/6845#discussion_r323727241
 
 

 ##
 File path: 
modules/core/src/main/java/org/apache/ignite/spi/metric/list/MonitoringRow.java
 ##
 @@ -0,0 +1,32 @@
+/*
+ * 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.spi.metric.list;
+
+import org.apache.ignite.internal.processors.metric.GridMetricManager;
+import org.apache.ignite.spi.metric.ReadOnlyMonitoringListRegistry;
+
+/**
+ * Monitoring list row base interface.
+ * Each row idenitified by the instance of {@code Id}.
 
 Review comment:
   "Each row idenitified by the instance of {@code Id}" what does it mean? I 
didn't see any "Id" field in *View classes.


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [ignite] alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: Monitoring list engine.

2019-09-12 Thread GitBox
alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: 
Monitoring list engine.
URL: https://github.com/apache/ignite/pull/6845#discussion_r323715442
 
 

 ##
 File path: 
modules/core/src/main/java/org/apache/ignite/spi/metric/list/MonitoringRow.java
 ##
 @@ -0,0 +1,32 @@
+/*
+ * 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.spi.metric.list;
+
+import org.apache.ignite.internal.processors.metric.GridMetricManager;
+import org.apache.ignite.spi.metric.ReadOnlyMonitoringListRegistry;
+
+/**
+ * Monitoring list row base interface.
+ * Each row idenitified by the instance of {@code Id}.
 
 Review comment:
   I think we should describe explicitly in JavaDoc which types of fields are 
acceptable for MonitoringRow view. 


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [ignite] alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: Monitoring list engine.

2019-09-12 Thread GitBox
alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: 
Monitoring list engine.
URL: https://github.com/apache/ignite/pull/6845#discussion_r323689188
 
 

 ##
 File path: 
modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
 ##
 @@ -7040,6 +7042,51 @@ public static String toShortString(Collection ns) {
 return sb.a(']').toString();
 }
 
+/**
+ * Get string representation of an object properly catching all exceptions.
+ *
+ * @param obj Object.
+ * @return Result or {@code null}.
+ */
+@Nullable public static String toStringSafe(@Nullable Object obj) {
+if (obj == null)
+return null;
+else {
+try {
+return obj.toString();
+}
+catch (Exception e) {
+try {
+return "Failed to convert object to string: " + 
e.getMessage();
+}
+catch (Exception e0) {
+return "Failed to convert object to string (error message 
is not available)";
+}
+}
+}
+}
+
+/**
+ * @param objs Collection of objects.
+ * @return String representation.
+ */
+@Nullable public static String toStringSafe(@Nullable Collection 
objs) {
 
 Review comment:
   See no usages of this method. Did I miss something?


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [ignite] alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: Monitoring list engine.

2019-09-12 Thread GitBox
alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: 
Monitoring list engine.
URL: https://github.com/apache/ignite/pull/6845#discussion_r323676402
 
 

 ##
 File path: 
modules/core/src/main/java/org/apache/ignite/internal/processors/service/IgniteServiceProcessor.java
 ##
 @@ -185,6 +188,12 @@
  */
 public IgniteServiceProcessor(GridKernalContext ctx) {
 super(ctx);
+
+ctx.metric().registerList(SVCS_MON_LIST, SVCS_MON_LIST_DESC,
+ServiceView.class,
+registeredServices,
+s -> s,
+s -> {});
 
 Review comment:
   If there are plans to use more such no-op cleaners in following-up PRs, 
perhaps it's better to pass `null` and correctly handle nulls in `registerList` 
method.


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [ignite] alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: Monitoring list engine.

2019-09-12 Thread GitBox
alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: 
Monitoring list engine.
URL: https://github.com/apache/ignite/pull/6845#discussion_r323645590
 
 

 ##
 File path: 
modules/core/src/main/java/org/apache/ignite/internal/processors/metric/list/MonitoringListAdapter.java
 ##
 @@ -0,0 +1,72 @@
+/*
+ * 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.processors.metric.list;
+
+import java.util.Iterator;
+import java.util.concurrent.ConcurrentMap;
+import java.util.function.Function;
+import org.apache.ignite.spi.metric.list.MonitoringRow;
+import org.apache.ignite.spi.metric.list.MonitoringRowAttributeWalker;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * Monitoring list backed by {@code data} {@link ConcurrentMap}.
+ */
+public class MonitoringListAdapter extends 
AbstractMonitoringList {
+/** Data backed by this list. */
+private final ConcurrentMap data;
 
 Review comment:
   What I'm seeing is exactly the opposite: we don't need `ConcurrentMap` 
backed implementation for now. We need `Collection` backed implementation 
(inside the engine) and you use `ConcurrentMap` as a `Collection`.


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [ignite] alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: Monitoring list engine.

2019-09-12 Thread GitBox
alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: 
Monitoring list engine.
URL: https://github.com/apache/ignite/pull/6845#discussion_r323645590
 
 

 ##
 File path: 
modules/core/src/main/java/org/apache/ignite/internal/processors/metric/list/MonitoringListAdapter.java
 ##
 @@ -0,0 +1,72 @@
+/*
+ * 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.processors.metric.list;
+
+import java.util.Iterator;
+import java.util.concurrent.ConcurrentMap;
+import java.util.function.Function;
+import org.apache.ignite.spi.metric.list.MonitoringRow;
+import org.apache.ignite.spi.metric.list.MonitoringRowAttributeWalker;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * Monitoring list backed by {@code data} {@link ConcurrentMap}.
+ */
+public class MonitoringListAdapter extends 
AbstractMonitoringList {
+/** Data backed by this list. */
+private final ConcurrentMap data;
 
 Review comment:
   What I'm seeing is exactly the opposite: we don't need `ConcurrentMap` 
backed implementation for now. We need 'Collection' backed implementation and 
you use `ConcurrentMap` as a `Collection`.


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [ignite] alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: Monitoring list engine.

2019-09-12 Thread GitBox
alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: 
Monitoring list engine.
URL: https://github.com/apache/ignite/pull/6845#discussion_r323645590
 
 

 ##
 File path: 
modules/core/src/main/java/org/apache/ignite/internal/processors/metric/list/MonitoringListAdapter.java
 ##
 @@ -0,0 +1,72 @@
+/*
+ * 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.processors.metric.list;
+
+import java.util.Iterator;
+import java.util.concurrent.ConcurrentMap;
+import java.util.function.Function;
+import org.apache.ignite.spi.metric.list.MonitoringRow;
+import org.apache.ignite.spi.metric.list.MonitoringRowAttributeWalker;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * Monitoring list backed by {@code data} {@link ConcurrentMap}.
+ */
+public class MonitoringListAdapter extends 
AbstractMonitoringList {
+/** Data backed by this list. */
+private final ConcurrentMap data;
 
 Review comment:
   What I'm seeing is exactly the opposite: we don't need 'ConcurrentMap' 
backed implementation for now. We need 'Collection' backed implementation and 
you use `ConcurrentMap` as a `Collection`.


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [ignite] alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: Monitoring list engine.

2019-09-12 Thread GitBox
alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: 
Monitoring list engine.
URL: https://github.com/apache/ignite/pull/6845#discussion_r323635809
 
 

 ##
 File path: 
modules/core/src/main/java/org/apache/ignite/internal/processors/metric/GridMetricManager.java
 ##
 @@ -177,9 +222,63 @@
 /** Registered metrics registries. */
 private final ConcurrentHashMap registries = new 
ConcurrentHashMap<>();
 
+/** Metrics registry. */
+private final ReadOnlyMetricRegistry metricsRegistry = new 
ReadOnlyMetricRegistry() {
+/** {@inheritDoc} */
+@NotNull @Override public Iterator iterator() {
+return registries.values().iterator();
+}
+
+/** {@inheritDoc} */
+@Override public void 
addMetricRegistryCreationListener(Consumer lsnr) {
+metricRegCreationLsnrs.add(lsnr);
+}
+
+/** {@inheritDoc} */
+@Override public void 
addMetricRegistryRemoveListener(Consumer lsnr) {
+metricRegRemoveLsnrs.add(lsnr);
+}
+};
+
+/** Registered lists. */
+private final ConcurrentHashMap> lists = new 
ConcurrentHashMap<>();
+
+/** Lists registry. */
+private final ReadOnlyMonitoringListRegistry listRegistry = new 
ReadOnlyMonitoringListRegistry() {
+/** {@inheritDoc} */
+@Override public void 
addListCreationListener(Consumer> lsnr) {
+listCreationLsnrs.add(lsnr);
+}
+
+/** {@inheritDoc} */
+@Override public void 
addListRemoveListener(Consumer> lsnr) {
+listRemoveLsnrs.add(lsnr);
+}
+
+/** {@inheritDoc} */
+@NotNull @Override public Iterator> iterator() {
+return lists.values().iterator();
+}
+};
+
 /** Metric registry creation listeners. */
 private final List> metricRegCreationLsnrs = new 
CopyOnWriteArrayList<>();
 
+/** Metric registry remove listeners. */
+private final List> metricRegRemoveLsnrs = new 
CopyOnWriteArrayList<>();
+
+/** List creation listeners. */
+private final List>> listCreationLsnrs = new 
CopyOnWriteArrayList<>();
+
+/** List remove listeners. */
+private final List>> listRemoveLsnrs = new 
CopyOnWriteArrayList<>();
+
+/** Internal list remove listeners. */
+private final ConcurrentMap>> 
internalRemoveLsnrs = new ConcurrentHashMap<>();
+
+/** List enable listeners. */
+private final ConcurrentMap> listEnableLsnrs = 
new ConcurrentHashMap<>();
 
 Review comment:
   1. Once again. It's not a listener. Let's rename it to something 
like`listCreators`
   2. It's not a consumer, there is nothing to consume, you just throw away 
parameter which you get in this consumer. Let's use `Runnable`.
   
   The same for `internalRemoveLsnrs`
   


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [ignite] alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: Monitoring list engine.

2019-09-12 Thread GitBox
alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: 
Monitoring list engine.
URL: https://github.com/apache/ignite/pull/6845#discussion_r323637032
 
 

 ##
 File path: 
modules/core/src/main/java/org/apache/ignite/internal/processors/metric/GridMetricManager.java
 ##
 @@ -265,47 +379,127 @@ public MetricRegistry registry(String name) {
 return registries.computeIfAbsent(name, n -> {
 MetricRegistry mreg = new MetricRegistry(name, log);
 
-notifyListeners(mreg, metricRegCreationLsnrs);
+notifyListeners(mreg, metricRegCreationLsnrs, log);
 
 return mreg;
 });
 }
 
-/** {@inheritDoc} */
-@NotNull @Override public Iterator iterator() {
-return registries.values().iterator();
+/**
+ * Registers list which exports {@link ConcurrentMap} content.
+ *
+ * @param name Name of the list.
+ * @param desc Description of the list.
+ * @param rowCls Row class.
+ * @param data Data of the list.
+ * @param rowFunc value to row function.
+ * @param rowClearer Function that clears data on list removal.
+ * @param  List row type.
+ * @param  Map data type.
+ */
+public  void registerList(String name, String 
desc,
+Class rowCls, ConcurrentMap data, Function rowFunc, 
Consumer rowClearer) {
+
+Supplier> listCreator = () -> 
(MonitoringList)lists.computeIfAbsent(name, n -> {
+MonitoringList list = new MonitoringListAdapter<>(name,
+desc,
+rowCls,
+(MonitoringRowAttributeWalker)walkers.get(rowCls),
+data,
+rowFunc);
+
+notifyListeners(list, listCreationLsnrs, log);
+
+return list;
+});
+
+// Create new instance of the list.
+listCreator.get();
+
+ctx.metric().addEnableListListener(name, n -> listCreator.get());
 
 Review comment:
   Let's inline `listCreators.put()` here and pass `listCreators` as `Runnable` 
without creating new lambda.
   Methods `addEnableListListener` and `addRemoveListListener` can be removed.


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [ignite] alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: Monitoring list engine.

2019-09-12 Thread GitBox
alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: 
Monitoring list engine.
URL: https://github.com/apache/ignite/pull/6845#discussion_r323636180
 
 

 ##
 File path: 
modules/core/src/main/java/org/apache/ignite/internal/processors/metric/GridMetricManager.java
 ##
 @@ -265,47 +379,127 @@ public MetricRegistry registry(String name) {
 return registries.computeIfAbsent(name, n -> {
 MetricRegistry mreg = new MetricRegistry(name, log);
 
-notifyListeners(mreg, metricRegCreationLsnrs);
+notifyListeners(mreg, metricRegCreationLsnrs, log);
 
 return mreg;
 });
 }
 
-/** {@inheritDoc} */
-@NotNull @Override public Iterator iterator() {
-return registries.values().iterator();
+/**
+ * Registers list which exports {@link ConcurrentMap} content.
+ *
+ * @param name Name of the list.
+ * @param desc Description of the list.
+ * @param rowCls Row class.
+ * @param data Data of the list.
+ * @param rowFunc value to row function.
+ * @param rowClearer Function that clears data on list removal.
+ * @param  List row type.
+ * @param  Map data type.
+ */
+public  void registerList(String name, String 
desc,
+Class rowCls, ConcurrentMap data, Function rowFunc, 
Consumer rowClearer) {
+
+Supplier> listCreator = () -> 
(MonitoringList)lists.computeIfAbsent(name, n -> {
 
 Review comment:
   It's not a supplier, you just throw away returned value. Let's use `Runnable`


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [ignite] alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: Monitoring list engine.

2019-09-12 Thread GitBox
alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: 
Monitoring list engine.
URL: https://github.com/apache/ignite/pull/6845#discussion_r323635809
 
 

 ##
 File path: 
modules/core/src/main/java/org/apache/ignite/internal/processors/metric/GridMetricManager.java
 ##
 @@ -177,9 +222,63 @@
 /** Registered metrics registries. */
 private final ConcurrentHashMap registries = new 
ConcurrentHashMap<>();
 
+/** Metrics registry. */
+private final ReadOnlyMetricRegistry metricsRegistry = new 
ReadOnlyMetricRegistry() {
+/** {@inheritDoc} */
+@NotNull @Override public Iterator iterator() {
+return registries.values().iterator();
+}
+
+/** {@inheritDoc} */
+@Override public void 
addMetricRegistryCreationListener(Consumer lsnr) {
+metricRegCreationLsnrs.add(lsnr);
+}
+
+/** {@inheritDoc} */
+@Override public void 
addMetricRegistryRemoveListener(Consumer lsnr) {
+metricRegRemoveLsnrs.add(lsnr);
+}
+};
+
+/** Registered lists. */
+private final ConcurrentHashMap> lists = new 
ConcurrentHashMap<>();
+
+/** Lists registry. */
+private final ReadOnlyMonitoringListRegistry listRegistry = new 
ReadOnlyMonitoringListRegistry() {
+/** {@inheritDoc} */
+@Override public void 
addListCreationListener(Consumer> lsnr) {
+listCreationLsnrs.add(lsnr);
+}
+
+/** {@inheritDoc} */
+@Override public void 
addListRemoveListener(Consumer> lsnr) {
+listRemoveLsnrs.add(lsnr);
+}
+
+/** {@inheritDoc} */
+@NotNull @Override public Iterator> iterator() {
+return lists.values().iterator();
+}
+};
+
 /** Metric registry creation listeners. */
 private final List> metricRegCreationLsnrs = new 
CopyOnWriteArrayList<>();
 
+/** Metric registry remove listeners. */
+private final List> metricRegRemoveLsnrs = new 
CopyOnWriteArrayList<>();
+
+/** List creation listeners. */
+private final List>> listCreationLsnrs = new 
CopyOnWriteArrayList<>();
+
+/** List remove listeners. */
+private final List>> listRemoveLsnrs = new 
CopyOnWriteArrayList<>();
+
+/** Internal list remove listeners. */
+private final ConcurrentMap>> 
internalRemoveLsnrs = new ConcurrentHashMap<>();
+
+/** List enable listeners. */
+private final ConcurrentMap> listEnableLsnrs = 
new ConcurrentHashMap<>();
 
 Review comment:
   1. Once again. It's not a listener. Let's rename it to something 
like`listCreators`
   2. It's not a consumer, there is nothing to consume, you just throw away 
parameter which you get in this consumer.
   The same for `internalRemoveLsnrs`
   


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [ignite] alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: Monitoring list engine.

2019-09-12 Thread GitBox
alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: 
Monitoring list engine.
URL: https://github.com/apache/ignite/pull/6845#discussion_r323618617
 
 

 ##
 File path: 
modules/core/src/main/java/org/apache/ignite/internal/processors/metric/list/MonitoringListAdapter.java
 ##
 @@ -0,0 +1,72 @@
+/*
+ * 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.processors.metric.list;
+
+import java.util.Iterator;
+import java.util.concurrent.ConcurrentMap;
+import java.util.function.Function;
+import org.apache.ignite.spi.metric.list.MonitoringRow;
+import org.apache.ignite.spi.metric.list.MonitoringRowAttributeWalker;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * Monitoring list backed by {@code data} {@link ConcurrentMap}.
+ */
+public class MonitoringListAdapter extends 
AbstractMonitoringList {
+/** Data backed by this list. */
+private final ConcurrentMap data;
 
 Review comment:
   How you will force a user to pass thread-safety implementation of collection 
if there will have another implementation of `MonitoringList` which consumes 
`Collection`?
   
   I think it's not a reason to use extended class only to state it's thread 
safety. 
   Also, you can state about thread safety in JavaDoc .


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [ignite] alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: Monitoring list engine.

2019-09-12 Thread GitBox
alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: 
Monitoring list engine.
URL: https://github.com/apache/ignite/pull/6845#discussion_r323615290
 
 

 ##
 File path: 
modules/core/src/main/java/org/apache/ignite/internal/processors/metric/GridMetricManager.java
 ##
 @@ -265,45 +378,116 @@ public MetricRegistry registry(String name) {
 return registries.computeIfAbsent(name, n -> {
 MetricRegistry mreg = new MetricRegistry(name, log);
 
-notifyListeners(mreg, metricRegCreationLsnrs);
+notifyListeners(mreg, metricRegCreationLsnrs, log);
 
 return mreg;
 });
 }
 
-/** {@inheritDoc} */
-@NotNull @Override public Iterator iterator() {
-return registries.values().iterator();
+public  void list(String name, String 
description,
+Class rowClazz, Supplier> data, Function 
rowFunc, Consumer clearer) {
+
+Supplier> listCreator = () -> list(name, () -> new 
MonitoringListAdapter<>(name,
+description,
+rowClazz,
+(MonitoringRowAttributeWalker)walkers.get(rowClazz),
+data.get(),
+rowFunc));
+
+//Create new instance of the list.
+listCreator.get();
+
+ctx.metric().addEnableListListener(listenOnlyEqual(name, identity(), n 
-> listCreator.get()));
 
 Review comment:
   > This will require one more additional listener map because we already have 
'List' of the listeners that comes from MonitoringExporterSpi
   
   I think it's fine to have addition list of listeners for 
`MonitoringExporterSpi`. So we will have one map of list removers and one list 
of listeners.
   
   > I expect very few enable/disable events, and from 10 to 20 lists over 
Ignite, so we shouldn't observe performance issues because of name check in 
listenOnlyEqual.
   
   It's mostly not a performance issue, but a wrongly used pattern issue (which 
leads to readability and undesirability issue).
   
   >  Seems, I'm already did it.
   
   Looks much better now!
   
   > What is the issue with the lambdas count, in the first place?
   > Do you see some issues with code readability, understandability?
   
   Yes, it's about readability and understandability.


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [ignite] alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: Monitoring list engine.

2019-09-12 Thread GitBox
alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: 
Monitoring list engine.
URL: https://github.com/apache/ignite/pull/6845#discussion_r323615290
 
 

 ##
 File path: 
modules/core/src/main/java/org/apache/ignite/internal/processors/metric/GridMetricManager.java
 ##
 @@ -265,45 +378,116 @@ public MetricRegistry registry(String name) {
 return registries.computeIfAbsent(name, n -> {
 MetricRegistry mreg = new MetricRegistry(name, log);
 
-notifyListeners(mreg, metricRegCreationLsnrs);
+notifyListeners(mreg, metricRegCreationLsnrs, log);
 
 return mreg;
 });
 }
 
-/** {@inheritDoc} */
-@NotNull @Override public Iterator iterator() {
-return registries.values().iterator();
+public  void list(String name, String 
description,
+Class rowClazz, Supplier> data, Function 
rowFunc, Consumer clearer) {
+
+Supplier> listCreator = () -> list(name, () -> new 
MonitoringListAdapter<>(name,
+description,
+rowClazz,
+(MonitoringRowAttributeWalker)walkers.get(rowClazz),
+data.get(),
+rowFunc));
+
+//Create new instance of the list.
+listCreator.get();
+
+ctx.metric().addEnableListListener(listenOnlyEqual(name, identity(), n 
-> listCreator.get()));
 
 Review comment:
   > This will require one more additional listener map because we already have 
'List' of the listeners that comes from MonitoringExporterSpi
   I think it's fine to have addition list of listeners for 
`MonitoringExporterSpi`. So we will have one map of list removers and one list 
of listeners.
   
   > I expect very few enable/disable events, and from 10 to 20 lists over 
Ignite, so we shouldn't observe performance issues because of name check in 
listenOnlyEqual.
   It's mostly not a performance issue, but a wrongly used pattern issue (which 
leads to readability and undesirability issue).
   
   >  Seems, I'm already did it.
   Looks much better now!
   
   > What is the issue with the lambdas count, in the first place?
   > Do you see some issues with code readability, understandability?
   Yes, it's about readability and understandability.


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [ignite] alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: Monitoring list engine.

2019-09-12 Thread GitBox
alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: 
Monitoring list engine.
URL: https://github.com/apache/ignite/pull/6845#discussion_r323593329
 
 

 ##
 File path: 
modules/core/src/main/java/org/apache/ignite/internal/processors/metric/GridMetricManager.java
 ##
 @@ -265,45 +378,116 @@ public MetricRegistry registry(String name) {
 return registries.computeIfAbsent(name, n -> {
 MetricRegistry mreg = new MetricRegistry(name, log);
 
-notifyListeners(mreg, metricRegCreationLsnrs);
+notifyListeners(mreg, metricRegCreationLsnrs, log);
 
 return mreg;
 });
 }
 
-/** {@inheritDoc} */
-@NotNull @Override public Iterator iterator() {
-return registries.values().iterator();
+public  void list(String name, String 
description,
+Class rowClazz, Supplier> data, Function 
rowFunc, Consumer clearer) {
 
 Review comment:
   In this case, you will have the same problem with the current implementation 
too (the only difference is you can reenable the list to work correctly). 
   But I think it's better to re-register the list if class who owns the data 
recreates the map. In this case, the list will always be up to date and no 
reenabling is needed.


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [ignite] alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: Monitoring list engine.

2019-09-12 Thread GitBox
alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: 
Monitoring list engine.
URL: https://github.com/apache/ignite/pull/6845#discussion_r323591700
 
 

 ##
 File path: 
modules/core/src/main/java/org/apache/ignite/internal/processors/metric/GridMetricManager.java
 ##
 @@ -265,45 +378,116 @@ public MetricRegistry registry(String name) {
 return registries.computeIfAbsent(name, n -> {
 MetricRegistry mreg = new MetricRegistry(name, log);
 
-notifyListeners(mreg, metricRegCreationLsnrs);
+notifyListeners(mreg, metricRegCreationLsnrs, log);
 
 return mreg;
 });
 }
 
-/** {@inheritDoc} */
-@NotNull @Override public Iterator iterator() {
-return registries.values().iterator();
+public  void list(String name, String 
description,
+Class rowClazz, Supplier> data, Function 
rowFunc, Consumer clearer) {
+
+Supplier> listCreator = () -> list(name, () -> new 
MonitoringListAdapter<>(name,
+description,
+rowClazz,
+(MonitoringRowAttributeWalker)walkers.get(rowClazz),
+data.get(),
+rowFunc));
+
+//Create new instance of the list.
+listCreator.get();
+
+ctx.metric().addEnableListListener(listenOnlyEqual(name, identity(), n 
-> listCreator.get()));
+ctx.metric().addRemoveListListener(l -> 
data.get().values().forEach(clearer));
 }
 
-/** {@inheritDoc} */
-@Override public void 
addMetricRegistryCreationListener(Consumer lsnr) {
-metricRegCreationLsnrs.add(lsnr);
+/**
+ * @param name Name of the list.
+ * @return List.
+ */
+@Nullable public  MonitoringList list(String 
name) {
+return (MonitoringList)lists.get(name);
+}
+
+/**
+ * Gets or creates {@link MonitoringList}.
+ *
+ * @param name Name of the list.
+ * @param listSupplier List supplier.
+ * @param  Type of the row.
+ * @return Monitoring list.
+ */
+private  MonitoringList list(String name,
 
 Review comment:
   Let's don't introduce any functional prematurely, follow-up PRs also can 
have some fixes after review, so it's not a fact that this method will be 
needed.
   
   And here is naming problem again. You have overloaded `registerList` 
methods, one of it register some listeners, another one creates the list after 
enabling.


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [ignite] alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: Monitoring list engine.

2019-09-12 Thread GitBox
alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: 
Monitoring list engine.
URL: https://github.com/apache/ignite/pull/6845#discussion_r323589116
 
 

 ##
 File path: 
modules/core/src/main/java/org/apache/ignite/internal/processors/metric/list/MonitoringListAdapter.java
 ##
 @@ -0,0 +1,72 @@
+/*
+ * 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.processors.metric.list;
+
+import java.util.Iterator;
+import java.util.concurrent.ConcurrentMap;
+import java.util.function.Function;
+import org.apache.ignite.spi.metric.list.MonitoringRow;
+import org.apache.ignite.spi.metric.list.MonitoringRowAttributeWalker;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * Monitoring list backed by {@code data} {@link ConcurrentMap}.
+ */
+public class MonitoringListAdapter extends 
AbstractMonitoringList {
+/** Data backed by this list. */
+private final ConcurrentMap data;
 
 Review comment:
   You use only `values()` collection from this map. I see no reason to pass 
map here.
   
   And `Map` say nothing about thread safety. Thread safety provides by the 
implementation, not by the interface.


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [ignite] alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: Monitoring list engine.

2019-09-12 Thread GitBox
alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: 
Monitoring list engine.
URL: https://github.com/apache/ignite/pull/6845#discussion_r323587227
 
 

 ##
 File path: 
modules/core/src/main/java/org/apache/ignite/internal/processors/metric/GridMetricManager.java
 ##
 @@ -265,45 +378,116 @@ public MetricRegistry registry(String name) {
 return registries.computeIfAbsent(name, n -> {
 MetricRegistry mreg = new MetricRegistry(name, log);
 
-notifyListeners(mreg, metricRegCreationLsnrs);
+notifyListeners(mreg, metricRegCreationLsnrs, log);
 
 return mreg;
 });
 }
 
-/** {@inheritDoc} */
-@NotNull @Override public Iterator iterator() {
-return registries.values().iterator();
+public  void list(String name, String 
description,
+Class rowClazz, Supplier> data, Function 
rowFunc, Consumer clearer) {
+
+Supplier> listCreator = () -> list(name, () -> new 
MonitoringListAdapter<>(name,
+description,
+rowClazz,
+(MonitoringRowAttributeWalker)walkers.get(rowClazz),
+data.get(),
+rowFunc));
+
+//Create new instance of the list.
+listCreator.get();
+
+ctx.metric().addEnableListListener(listenOnlyEqual(name, identity(), n 
-> listCreator.get()));
 
 Review comment:
   I don't say that I didn't understand the code, I say that code is hard to 
understand because it uses 5-6 nested lambdas. It's certainly not a pretty 
simple.  
   
   I don't propose to rename it to "list enabler", I say that "listener" is a 
bad abstraction for this case.
   
   Perhaps code can be simplified in this way:
   1. Create maps for list creators and removers (name -> closure) instead of 
lists for listeners 
   2. On enabling/disabling just call closure from this map by name.
   3. Get rid of as most nested lambdas as possible. Now it looks redundant. 
Ideally, for list creation case there should be only two labdas: one for list 
creation closure, and one for `computeIfAbsent` mapping function.


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [ignite] alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: Monitoring list engine.

2019-09-12 Thread GitBox
alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: 
Monitoring list engine.
URL: https://github.com/apache/ignite/pull/6845#discussion_r323576215
 
 

 ##
 File path: 
modules/codegen/src/main/java/org/apache/ignite/codegen/MonitoringRowAttributeWalkerGenerator.java
 ##
 @@ -0,0 +1,289 @@
+/*
+ * 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.codegen;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.TreeSet;
+import java.util.function.ObjIntConsumer;
+import org.apache.ignite.internal.processors.metric.list.walker.Order;
+import org.apache.ignite.spi.metric.jmx.MonitoringListMBean;
+import org.apache.ignite.spi.metric.list.MonitoringList;
+import org.apache.ignite.spi.metric.list.MonitoringRow;
+import org.apache.ignite.spi.metric.list.MonitoringRowAttributeWalker;
+import org.apache.ignite.spi.metric.list.view.CacheGroupView;
+import org.apache.ignite.spi.metric.list.view.CacheView;
+import org.apache.ignite.spi.metric.list.view.ComputeTaskView;
+import org.apache.ignite.spi.metric.list.view.ServiceView;
+import org.apache.ignite.spi.metric.sql.MonitoringListLocalSystemView;
+
+import static org.apache.ignite.codegen.MessageCodeGenerator.DFLT_SRC_DIR;
 
 Review comment:
   Because classes not related to each other. Why I should change 
`MessageCodeGenerator` if I only want to change the path for 
`MonitoringRowAttributeWalkerGenerator`? 


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [ignite] alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: Monitoring list engine.

2019-09-11 Thread GitBox
alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: 
Monitoring list engine.
URL: https://github.com/apache/ignite/pull/6845#discussion_r323310505
 
 

 ##
 File path: 
modules/core/src/main/java/org/apache/ignite/internal/processors/metric/list/AbstractMonitoringList.java
 ##
 @@ -0,0 +1,79 @@
+/*
+ * 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.processors.metric.list;
+
+import org.apache.ignite.spi.metric.list.MonitoringList;
+import org.apache.ignite.spi.metric.list.MonitoringRow;
+import org.apache.ignite.spi.metric.list.MonitoringRowAttributeWalker;
+
+/**
+ *
+ */
+abstract class AbstractMonitoringList implements 
MonitoringList {
+/** Name of the list. */
+private final String name;
+
+/** Description of the list. */
+private final String description;
+
+/** Class of the row */
+private final Class rowClass;
+
+/**
+ * Row attribute walker.
+ *
+ * @see org.apache.ignite.codegen.MonitoringRowAttributeWalkerGenerator
 
 Review comment:
   Or at least you can use `@see "text"` syntax, but not `@see reference`


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [ignite] alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: Monitoring list engine.

2019-09-11 Thread GitBox
alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: 
Monitoring list engine.
URL: https://github.com/apache/ignite/pull/6845#discussion_r323306588
 
 

 ##
 File path: 
modules/core/src/main/java/org/apache/ignite/internal/processors/metric/list/AbstractMonitoringList.java
 ##
 @@ -0,0 +1,79 @@
+/*
+ * 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.processors.metric.list;
+
+import org.apache.ignite.spi.metric.list.MonitoringList;
+import org.apache.ignite.spi.metric.list.MonitoringRow;
+import org.apache.ignite.spi.metric.list.MonitoringRowAttributeWalker;
+
+/**
+ *
+ */
+abstract class AbstractMonitoringList implements 
MonitoringList {
+/** Name of the list. */
+private final String name;
+
+/** Description of the list. */
+private final String description;
+
+/** Class of the row */
+private final Class rowClass;
+
+/**
+ * Row attribute walker.
+ *
+ * @see org.apache.ignite.codegen.MonitoringRowAttributeWalkerGenerator
 
 Review comment:
   Not sure it's IDEA issue, perhaps we shouldn't link to unreachable classes 
even in JavaDoc.


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [ignite] alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: Monitoring list engine.

2019-09-11 Thread GitBox
alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: 
Monitoring list engine.
URL: https://github.com/apache/ignite/pull/6845#discussion_r323302473
 
 

 ##
 File path: 
modules/core/src/main/java/org/apache/ignite/internal/processors/metric/list/MonitoringListAdapter.java
 ##
 @@ -0,0 +1,72 @@
+/*
+ * 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.processors.metric.list;
+
+import java.util.Iterator;
+import java.util.concurrent.ConcurrentMap;
+import java.util.function.Function;
+import org.apache.ignite.spi.metric.list.MonitoringRow;
+import org.apache.ignite.spi.metric.list.MonitoringRowAttributeWalker;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * Monitoring list backed by {@code data} {@link ConcurrentMap}.
+ */
+public class MonitoringListAdapter extends 
AbstractMonitoringList {
+/** Data backed by this list. */
+private final ConcurrentMap data;
 
 Review comment:
   Why do we need `ConcurrentMap` here? It brings some restrictions to data 
source for lists. We only use `values()` and `size()` methods of `data` field, 
why can't we use `Collection`?


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [ignite] alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: Monitoring list engine.

2019-09-11 Thread GitBox
alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: 
Monitoring list engine.
URL: https://github.com/apache/ignite/pull/6845#discussion_r323301027
 
 

 ##
 File path: 
modules/core/src/main/java/org/apache/ignite/internal/processors/metric/list/ListUtils.java
 ##
 @@ -0,0 +1,47 @@
+/*
+ * 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.processors.metric.list;
+
+import java.util.Objects;
+import java.util.function.Consumer;
+import java.util.function.Function;
+import java.util.function.Supplier;
+import org.apache.ignite.spi.metric.list.MonitoringRow;
+import org.jetbrains.annotations.Nullable;
+
+/** Utils methods for monitoring list feature. */
+public final class ListUtils {
 
 Review comment:
   I think this class don't need at all after simplification of 
`GridMetricManager#list` method


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [ignite] alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: Monitoring list engine.

2019-09-11 Thread GitBox
alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: 
Monitoring list engine.
URL: https://github.com/apache/ignite/pull/6845#discussion_r323300532
 
 

 ##
 File path: 
modules/core/src/main/java/org/apache/ignite/internal/processors/metric/list/ListUtils.java
 ##
 @@ -0,0 +1,47 @@
+/*
+ * 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.processors.metric.list;
+
+import java.util.Objects;
+import java.util.function.Consumer;
+import java.util.function.Function;
+import java.util.function.Supplier;
+import org.apache.ignite.spi.metric.list.MonitoringRow;
+import org.jetbrains.annotations.Nullable;
 
 Review comment:
   Unused imports


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [ignite] alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: Monitoring list engine.

2019-09-11 Thread GitBox
alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: 
Monitoring list engine.
URL: https://github.com/apache/ignite/pull/6845#discussion_r323299667
 
 

 ##
 File path: 
modules/core/src/main/java/org/apache/ignite/internal/processors/metric/GridMetricManager.java
 ##
 @@ -265,45 +378,116 @@ public MetricRegistry registry(String name) {
 return registries.computeIfAbsent(name, n -> {
 MetricRegistry mreg = new MetricRegistry(name, log);
 
-notifyListeners(mreg, metricRegCreationLsnrs);
+notifyListeners(mreg, metricRegCreationLsnrs, log);
 
 return mreg;
 });
 }
 
-/** {@inheritDoc} */
-@NotNull @Override public Iterator iterator() {
-return registries.values().iterator();
+public  void list(String name, String 
description,
+Class rowClazz, Supplier> data, Function 
rowFunc, Consumer clearer) {
 
 Review comment:
   Do we really need `Supplier` for `data` parameter here? Why can't we use 
data without supplier?


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [ignite] alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: Monitoring list engine.

2019-09-11 Thread GitBox
alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: 
Monitoring list engine.
URL: https://github.com/apache/ignite/pull/6845#discussion_r323298289
 
 

 ##
 File path: 
modules/core/src/main/java/org/apache/ignite/internal/processors/metric/GridMetricManager.java
 ##
 @@ -265,45 +378,116 @@ public MetricRegistry registry(String name) {
 return registries.computeIfAbsent(name, n -> {
 MetricRegistry mreg = new MetricRegistry(name, log);
 
-notifyListeners(mreg, metricRegCreationLsnrs);
+notifyListeners(mreg, metricRegCreationLsnrs, log);
 
 return mreg;
 });
 }
 
-/** {@inheritDoc} */
-@NotNull @Override public Iterator iterator() {
-return registries.values().iterator();
+public  void list(String name, String 
description,
+Class rowClazz, Supplier> data, Function 
rowFunc, Consumer clearer) {
+
+Supplier> listCreator = () -> list(name, () -> new 
MonitoringListAdapter<>(name,
+description,
+rowClazz,
+(MonitoringRowAttributeWalker)walkers.get(rowClazz),
+data.get(),
+rowFunc));
+
+//Create new instance of the list.
+listCreator.get();
+
+ctx.metric().addEnableListListener(listenOnlyEqual(name, identity(), n 
-> listCreator.get()));
 
 Review comment:
   And actually it's not a listener. It's something like "list enabler", it's 
lack of abstraction here since listener should only react to this event, but 
not performing event itself.


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [ignite] alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: Monitoring list engine.

2019-09-11 Thread GitBox
alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: 
Monitoring list engine.
URL: https://github.com/apache/ignite/pull/6845#discussion_r323292475
 
 

 ##
 File path: 
modules/core/src/main/java/org/apache/ignite/internal/processors/metric/GridMetricManager.java
 ##
 @@ -265,45 +378,116 @@ public MetricRegistry registry(String name) {
 return registries.computeIfAbsent(name, n -> {
 MetricRegistry mreg = new MetricRegistry(name, log);
 
-notifyListeners(mreg, metricRegCreationLsnrs);
+notifyListeners(mreg, metricRegCreationLsnrs, log);
 
 return mreg;
 });
 }
 
-/** {@inheritDoc} */
-@NotNull @Override public Iterator iterator() {
-return registries.values().iterator();
+public  void list(String name, String 
description,
+Class rowClazz, Supplier> data, Function 
rowFunc, Consumer clearer) {
+
+Supplier> listCreator = () -> list(name, () -> new 
MonitoringListAdapter<>(name,
+description,
+rowClazz,
+(MonitoringRowAttributeWalker)walkers.get(rowClazz),
+data.get(),
+rowFunc));
+
+//Create new instance of the list.
+listCreator.get();
+
+ctx.metric().addEnableListListener(listenOnlyEqual(name, identity(), n 
-> listCreator.get()));
+ctx.metric().addRemoveListListener(l -> 
data.get().values().forEach(clearer));
 }
 
-/** {@inheritDoc} */
-@Override public void 
addMetricRegistryCreationListener(Consumer lsnr) {
-metricRegCreationLsnrs.add(lsnr);
+/**
+ * @param name Name of the list.
+ * @return List.
+ */
+@Nullable public  MonitoringList list(String 
name) {
+return (MonitoringList)lists.get(name);
+}
+
+/**
+ * Gets or creates {@link MonitoringList}.
+ *
+ * @param name Name of the list.
+ * @param listSupplier List supplier.
+ * @param  Type of the row.
+ * @return Monitoring list.
+ */
+private  MonitoringList list(String name,
 
 Review comment:
   Only one usage. Can be inlined into `list` (`createList`) and simplified


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [ignite] alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: Monitoring list engine.

2019-09-11 Thread GitBox
alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: 
Monitoring list engine.
URL: https://github.com/apache/ignite/pull/6845#discussion_r323291708
 
 

 ##
 File path: 
modules/core/src/main/java/org/apache/ignite/internal/processors/metric/GridMetricManager.java
 ##
 @@ -265,45 +378,116 @@ public MetricRegistry registry(String name) {
 return registries.computeIfAbsent(name, n -> {
 MetricRegistry mreg = new MetricRegistry(name, log);
 
-notifyListeners(mreg, metricRegCreationLsnrs);
+notifyListeners(mreg, metricRegCreationLsnrs, log);
 
 return mreg;
 });
 }
 
-/** {@inheritDoc} */
-@NotNull @Override public Iterator iterator() {
-return registries.values().iterator();
+public  void list(String name, String 
description,
 
 Review comment:
   Perhaps `createList` is a better name since you already have overloaded 
method with the same name, which only returns the existing list.


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [ignite] alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: Monitoring list engine.

2019-09-11 Thread GitBox
alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: 
Monitoring list engine.
URL: https://github.com/apache/ignite/pull/6845#discussion_r323282217
 
 

 ##
 File path: 
modules/core/src/main/java/org/apache/ignite/internal/processors/metric/GridMetricManager.java
 ##
 @@ -265,45 +378,116 @@ public MetricRegistry registry(String name) {
 return registries.computeIfAbsent(name, n -> {
 MetricRegistry mreg = new MetricRegistry(name, log);
 
-notifyListeners(mreg, metricRegCreationLsnrs);
+notifyListeners(mreg, metricRegCreationLsnrs, log);
 
 return mreg;
 });
 }
 
-/** {@inheritDoc} */
-@NotNull @Override public Iterator iterator() {
-return registries.values().iterator();
+public  void list(String name, String 
description,
+Class rowClazz, Supplier> data, Function 
rowFunc, Consumer clearer) {
+
+Supplier> listCreator = () -> list(name, () -> new 
MonitoringListAdapter<>(name,
+description,
+rowClazz,
+(MonitoringRowAttributeWalker)walkers.get(rowClazz),
+data.get(),
+rowFunc));
+
+//Create new instance of the list.
 
 Review comment:
   Space missed


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [ignite] alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: Monitoring list engine.

2019-09-11 Thread GitBox
alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: 
Monitoring list engine.
URL: https://github.com/apache/ignite/pull/6845#discussion_r323282109
 
 

 ##
 File path: 
modules/core/src/main/java/org/apache/ignite/internal/processors/metric/GridMetricManager.java
 ##
 @@ -265,45 +378,116 @@ public MetricRegistry registry(String name) {
 return registries.computeIfAbsent(name, n -> {
 MetricRegistry mreg = new MetricRegistry(name, log);
 
-notifyListeners(mreg, metricRegCreationLsnrs);
+notifyListeners(mreg, metricRegCreationLsnrs, log);
 
 return mreg;
 });
 }
 
-/** {@inheritDoc} */
-@NotNull @Override public Iterator iterator() {
-return registries.values().iterator();
+public  void list(String name, String 
description,
+Class rowClazz, Supplier> data, Function 
rowFunc, Consumer clearer) {
+
+Supplier> listCreator = () -> list(name, () -> new 
MonitoringListAdapter<>(name,
+description,
+rowClazz,
+(MonitoringRowAttributeWalker)walkers.get(rowClazz),
+data.get(),
+rowFunc));
+
+//Create new instance of the list.
+listCreator.get();
+
+ctx.metric().addEnableListListener(listenOnlyEqual(name, identity(), n 
-> listCreator.get()));
 
 Review comment:
   A very complicated logic here. It's up to 5-6 nested consumers/suppliers 
used for event listener. Perhaps it can be simplified somehow (but I'm not 
sure). In current implementation is hard to understand such a code.


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [ignite] alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: Monitoring list engine.

2019-09-11 Thread GitBox
alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: 
Monitoring list engine.
URL: https://github.com/apache/ignite/pull/6845#discussion_r323279076
 
 

 ##
 File path: 
modules/core/src/main/java/org/apache/ignite/internal/processors/metric/GridMetricManager.java
 ##
 @@ -265,45 +378,116 @@ public MetricRegistry registry(String name) {
 return registries.computeIfAbsent(name, n -> {
 MetricRegistry mreg = new MetricRegistry(name, log);
 
-notifyListeners(mreg, metricRegCreationLsnrs);
+notifyListeners(mreg, metricRegCreationLsnrs, log);
 
 return mreg;
 });
 }
 
-/** {@inheritDoc} */
-@NotNull @Override public Iterator iterator() {
-return registries.values().iterator();
+public  void list(String name, String 
description,
+Class rowClazz, Supplier> data, Function 
rowFunc, Consumer clearer) {
+
 
 Review comment:
   Redundand NL


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [ignite] alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: Monitoring list engine.

2019-09-11 Thread GitBox
alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: 
Monitoring list engine.
URL: https://github.com/apache/ignite/pull/6845#discussion_r323278949
 
 

 ##
 File path: 
modules/core/src/main/java/org/apache/ignite/internal/processors/metric/GridMetricManager.java
 ##
 @@ -265,45 +378,116 @@ public MetricRegistry registry(String name) {
 return registries.computeIfAbsent(name, n -> {
 MetricRegistry mreg = new MetricRegistry(name, log);
 
-notifyListeners(mreg, metricRegCreationLsnrs);
+notifyListeners(mreg, metricRegCreationLsnrs, log);
 
 return mreg;
 });
 }
 
-/** {@inheritDoc} */
-@NotNull @Override public Iterator iterator() {
-return registries.values().iterator();
+public  void list(String name, String 
description,
 
 Review comment:
   Missed JavaDoc


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [ignite] alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: Monitoring list engine.

2019-09-11 Thread GitBox
alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: 
Monitoring list engine.
URL: https://github.com/apache/ignite/pull/6845#discussion_r323276641
 
 

 ##
 File path: 
modules/core/src/main/java/org/apache/ignite/internal/processors/metric/GridMetricManager.java
 ##
 @@ -177,9 +224,60 @@
 /** Registered metrics registries. */
 private final ConcurrentHashMap registries = new 
ConcurrentHashMap<>();
 
+/** Metrics registry. */
+private final ReadOnlyMetricRegistry metricsRegistry = new 
ReadOnlyMetricRegistry() {
+/** {@inheritDoc} */
+@NotNull @Override public Iterator iterator() {
+return registries.values().iterator();
+}
+
+/** {@inheritDoc} */
+@Override public void 
addMetricRegistryCreationListener(Consumer lsnr) {
+metricRegCreationLsnrs.add(lsnr);
+}
+
+/** {@inheritDoc} */
+@Override public void 
addMetricRegistryRemoveListener(Consumer lsnr) {
+metricRegRemoveLsnrs.add(lsnr);
+}
+};
+
+/** Registered lists. */
+private final ConcurrentHashMap> lists = new 
ConcurrentHashMap<>();
+
+/** Lists registry. */
+private final ReadOnlyMonitoringListRegistry listRegistry = new 
ReadOnlyMonitoringListRegistry() {
+/** {@inheritDoc} */
+@Override public void 
addListCreationListener(Consumer> lsnr) {
+listCreationLsnrs.add(lsnr);
+}
+
+/** {@inheritDoc} */
+@Override public void 
addListRemoveListener(Consumer> lsnr) {
+listRemoveLsnrs.add(lsnr::accept);
 
 Review comment:
   Nested consumer creation, `lsnr::accept` should be replaced with `lsnr`


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [ignite] alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: Monitoring list engine.

2019-09-11 Thread GitBox
alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: 
Monitoring list engine.
URL: https://github.com/apache/ignite/pull/6845#discussion_r323265835
 
 

 ##
 File path: 
modules/core/src/main/java/org/apache/ignite/internal/processors/metric/list/AbstractMonitoringList.java
 ##
 @@ -0,0 +1,79 @@
+/*
+ * 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.processors.metric.list;
+
+import org.apache.ignite.spi.metric.list.MonitoringList;
+import org.apache.ignite.spi.metric.list.MonitoringRow;
+import org.apache.ignite.spi.metric.list.MonitoringRowAttributeWalker;
+
+/**
+ *
+ */
+abstract class AbstractMonitoringList implements 
MonitoringList {
+/** Name of the list. */
+private final String name;
+
+/** Description of the list. */
+private final String description;
+
+/** Class of the row */
+private final Class rowClass;
+
+/**
+ * Row attribute walker.
+ *
+ * @see org.apache.ignite.codegen.MonitoringRowAttributeWalkerGenerator
+ */
+private final MonitoringRowAttributeWalker walker;
+
+/**
+ * @param name Name of the list.
+ * @param description Description of the list.
+ * @param rowClass Class of the row.
+ * @param walker Row attribute walker.
+ */
+AbstractMonitoringList(String name, String description, Class rowClass, 
MonitoringRowAttributeWalker walker) {
 
 Review comment:
   It's desirable to use abbreviations for "description" and "class"


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [ignite] alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: Monitoring list engine.

2019-09-11 Thread GitBox
alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: 
Monitoring list engine.
URL: https://github.com/apache/ignite/pull/6845#discussion_r323261549
 
 

 ##
 File path: 
modules/core/src/main/java/org/apache/ignite/internal/processors/metric/list/AbstractMonitoringList.java
 ##
 @@ -0,0 +1,79 @@
+/*
+ * 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.processors.metric.list;
+
+import org.apache.ignite.spi.metric.list.MonitoringList;
+import org.apache.ignite.spi.metric.list.MonitoringRow;
+import org.apache.ignite.spi.metric.list.MonitoringRowAttributeWalker;
+
+/**
+ *
+ */
+abstract class AbstractMonitoringList implements 
MonitoringList {
+/** Name of the list. */
+private final String name;
+
+/** Description of the list. */
+private final String description;
+
+/** Class of the row */
+private final Class rowClass;
+
+/**
+ * Row attribute walker.
+ *
+ * @see org.apache.ignite.codegen.MonitoringRowAttributeWalkerGenerator
 
 Review comment:
   IDEA highlighted this line as an error, since 
MonitoringRowAttributeWalkerGenerator from module `ignite-codegen` which is not 
in dependencies.


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [ignite] alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: Monitoring list engine.

2019-09-11 Thread GitBox
alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: 
Monitoring list engine.
URL: https://github.com/apache/ignite/pull/6845#discussion_r323258999
 
 

 ##
 File path: 
modules/codegen/src/main/java/org/apache/ignite/codegen/MonitoringRowAttributeWalkerGenerator.java
 ##
 @@ -0,0 +1,289 @@
+/*
+ * 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.codegen;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.TreeSet;
+import java.util.function.ObjIntConsumer;
+import org.apache.ignite.internal.processors.metric.list.walker.Order;
+import org.apache.ignite.spi.metric.jmx.MonitoringListMBean;
+import org.apache.ignite.spi.metric.list.MonitoringList;
+import org.apache.ignite.spi.metric.list.MonitoringRow;
+import org.apache.ignite.spi.metric.list.MonitoringRowAttributeWalker;
+import org.apache.ignite.spi.metric.list.view.CacheGroupView;
+import org.apache.ignite.spi.metric.list.view.CacheView;
+import org.apache.ignite.spi.metric.list.view.ComputeTaskView;
+import org.apache.ignite.spi.metric.list.view.ServiceView;
+import org.apache.ignite.spi.metric.sql.MonitoringListLocalSystemView;
+
+import static org.apache.ignite.codegen.MessageCodeGenerator.DFLT_SRC_DIR;
+
+/**
+ * Application for code generation of {@link MonitoringRowAttributeWalker}.
+ * Usage: simply run main method from Ignite source folder(using IDE or other 
way).
+ * Generated code used in {@link MonitoringList}.
+ *
+ * @see MonitoringListMBean
+ * @see MonitoringListLocalSystemView
+ */
+public class MonitoringRowAttributeWalkerGenerator {
+/** Methods that should be excluded from specific {@link 
MonitoringRowAttributeWalker}. */
+private static final Set SYS_METHODS = new 
HashSet<>(Arrays.asList("equals", "hashCode", "toString",
+"getClass", "monitoringRowId"));
+
+/** Package for {@link MonitoringRowAttributeWalker} implementations. */
+public static final String WALKER_PACKAGE = 
"org.apache.ignite.internal.processors.metric.list.walker";
+
+/** */
+public static final String TAB = "";
+
+/**
+ * @throws Exception If generation failed.
+ */
+public static void main(String[] args) throws Exception {
+MonitoringRowAttributeWalkerGenerator gen = new 
MonitoringRowAttributeWalkerGenerator();
+
+gen.generateAndWrite(CacheGroupView.class, DFLT_SRC_DIR);
+gen.generateAndWrite(CacheView.class, DFLT_SRC_DIR);
+gen.generateAndWrite(ServiceView.class, DFLT_SRC_DIR);
+gen.generateAndWrite(ComputeTaskView.class, DFLT_SRC_DIR);
+}
+
+/**
+ * Generates {@link MonitoringRowAttributeWalker} implementation and write 
it to the file.
+ *
+ * @param clazz Class to geneare {@link MonitoringRowAttributeWalker} for.
+ * @param srcRoot Source root folder.
+ * @param  type of the {@link MonitoringRow}.
+ * @throws IOException If generation failed.
+ */
+private  void generateAndWrite(Class clazz, 
String srcRoot) throws IOException {
+File walkerClass = new File(srcRoot + '/' + 
WALKER_PACKAGE.replaceAll("\\.", "/") + '/' +
+clazz.getSimpleName() + "Walker.java");
+
+Collection code = generate(clazz);
+
+walkerClass.createNewFile();
+
+try (FileWriter writer = new FileWriter(walkerClass)) {
+for (String line : code) {
+writer.write(line);
+writer.write('\n');
+}
+}
+}
+
+/**
+ * Generates {@link MonitoringRowAttributeWalker} implementation.
+ *
+ * @param clazz Class to geneare {@link MonitoringRowAttributeWalker} for.
+ * @param  type of the {@link MonitoringRow}.
+ * @return Java source code of the {@link MonitoringRowAttributeWalker} 
implementation.
+ */
+private  Collection generate(Class 
clazz) {
+final List code = new 

[GitHub] [ignite] alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: Monitoring list engine.

2019-09-11 Thread GitBox
alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: 
Monitoring list engine.
URL: https://github.com/apache/ignite/pull/6845#discussion_r323258405
 
 

 ##
 File path: 
modules/codegen/src/main/java/org/apache/ignite/codegen/MonitoringRowAttributeWalkerGenerator.java
 ##
 @@ -0,0 +1,289 @@
+/*
+ * 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.codegen;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.TreeSet;
+import java.util.function.ObjIntConsumer;
+import org.apache.ignite.internal.processors.metric.list.walker.Order;
+import org.apache.ignite.spi.metric.jmx.MonitoringListMBean;
+import org.apache.ignite.spi.metric.list.MonitoringList;
+import org.apache.ignite.spi.metric.list.MonitoringRow;
+import org.apache.ignite.spi.metric.list.MonitoringRowAttributeWalker;
+import org.apache.ignite.spi.metric.list.view.CacheGroupView;
+import org.apache.ignite.spi.metric.list.view.CacheView;
+import org.apache.ignite.spi.metric.list.view.ComputeTaskView;
+import org.apache.ignite.spi.metric.list.view.ServiceView;
+import org.apache.ignite.spi.metric.sql.MonitoringListLocalSystemView;
+
+import static org.apache.ignite.codegen.MessageCodeGenerator.DFLT_SRC_DIR;
 
 Review comment:
   Sorry, I misplaced my previous comment about static import from 
`MessageCodeGenerator`. I mean DFLT_SRC_DIR need to be independent for these 
classes. But this comment replated to `TAB` constant too. If you will fix this, 
there is no need to change `MessageCodeGenerator` at all. 


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [ignite] alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: Monitoring list engine.

2019-09-09 Thread GitBox
alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: 
Monitoring list engine.
URL: https://github.com/apache/ignite/pull/6845#discussion_r322300993
 
 

 ##
 File path: 
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ClusterCachesInfo.java
 ##
 @@ -2514,7 +2572,7 @@ public void removeRestartingCaches() {
 if (o1.cacheType().userCache() ^ o2.cacheType().userCache())
 return o2.cacheType().userCache() ? -1 : 1;
 
-return o1.cacheId().compareTo(o2.cacheId());
+return o1.cacheId() - o2.cacheId();
 
 Review comment:
   Undesirable change. Has almost the same logic as before, but produce errors 
on some corner cases. Not related to this ticket.


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [ignite] alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: Monitoring list engine.

2019-09-09 Thread GitBox
alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: 
Monitoring list engine.
URL: https://github.com/apache/ignite/pull/6845#discussion_r322300057
 
 

 ##
 File path: 
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ClusterCachesInfo.java
 ##
 @@ -1397,7 +1438,10 @@ else if 
(!GridFunc.eqNotOrdered(desc.schema().entities(), localQueryEntities))
 
 desc.receivedOnDiscovery(true);
 
-registeredCaches.put(cacheData.cacheConfiguration().getName(), 
desc);
+String cacheName = cacheData.cacheConfiguration().getName();
 
 Review comment:
   Redundant change, `cacheName` has only one usage


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [ignite] alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: Monitoring list engine.

2019-09-09 Thread GitBox
alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: 
Monitoring list engine.
URL: https://github.com/apache/ignite/pull/6845#discussion_r322296920
 
 

 ##
 File path: 
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ClusterCachesInfo.java
 ##
 @@ -145,6 +173,14 @@
 public ClusterCachesInfo(GridKernalContext ctx) {
 this.ctx = ctx;
 
+ctx.metric().list(CACHES_MON_LIST, CACHES_MON_LIST_DESC, 
CacheView.class,
+l -> cachesMonList = l,
+l -> cachesMonList = null);
+
+ctx.metric().list(CACHE_GRPS_MON_LIST, CACHE_GRPS_MON_LIST_DESC, 
CacheGroupView.class,
+l -> cachesGrpMonList = l,
+l -> cachesGrpMonList = null);
+
 
 Review comment:
   List will be inconsistent when someone will disable it in runtime, create 
new caches and enable again.


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [ignite] alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: Monitoring list engine.

2019-09-09 Thread GitBox
alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: 
Monitoring list engine.
URL: https://github.com/apache/ignite/pull/6845#discussion_r321766322
 
 

 ##
 File path: 
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheGroupContext.java
 ##
 @@ -773,6 +773,13 @@ public GridAffinityAssignmentCache affinity() {
  * @return Group name if it is specified, otherwise cache name.
  */
 public String cacheOrGroupName() {
+return cacheOrGroupName(ccfg);
+}
+
+/**
+ * @return Group name if it is specified, otherwise cache name.
+ */
+public static String cacheOrGroupName(CacheConfiguration ccfg) {
 
 Review comment:
   Do we need this change? There is only one usage of this method.


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [ignite] alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: Monitoring list engine.

2019-09-09 Thread GitBox
alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: 
Monitoring list engine.
URL: https://github.com/apache/ignite/pull/6845#discussion_r321754308
 
 

 ##
 File path: 
modules/codegen/src/main/java/org/apache/ignite/codegen/MonitoringRowAttributeWalkerGenerator.java
 ##
 @@ -0,0 +1,283 @@
+/*
+ * 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.codegen;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.TreeSet;
+import java.util.function.ObjIntConsumer;
+import org.apache.ignite.internal.processors.metric.list.walker.Order;
+import org.apache.ignite.spi.metric.jmx.MonitoringListMBean;
+import org.apache.ignite.spi.metric.list.MonitoringList;
+import org.apache.ignite.spi.metric.list.MonitoringRow;
+import org.apache.ignite.spi.metric.list.MonitoringRowAttributeWalker;
+import org.apache.ignite.spi.metric.list.view.CacheGroupView;
+import org.apache.ignite.spi.metric.list.view.CacheView;
+import org.apache.ignite.spi.metric.list.view.ComputeTaskView;
+import org.apache.ignite.spi.metric.list.view.ServiceView;
+
+import static org.apache.ignite.codegen.MessageCodeGenerator.DFLT_SRC_DIR;
+import static org.apache.ignite.codegen.MessageCodeGenerator.TAB;
+
+/**
+ * Application for code generation of {@link MonitoringRowAttributeWalker}.
+ * Usage: simply run main method from Ignite source folder(using IDE or other 
way).
+ * Generated code used in {@link MonitoringList}.
+ *
+ * @see MonitoringListMBean
+ * @see MonitoringListLocalSystemView
+ */
+public class MonitoringRowAttributeWalkerGenerator {
+/** Methods that should be excluded from specific {@link 
MonitoringRowAttributeWalker}. */
+private static final Set SYS_METHODS = new 
HashSet<>(Arrays.asList("equals", "hashCode", "toString",
+"getClass", "monitoringRowId"));
+
+/** Package for {@link MonitoringRowAttributeWalker} implementations. */
+public static final String WALKER_PACKAGE = 
"org.apache.ignite.internal.processors.metric.list.walker";
+
+/**
+ * @throws Exception If generation failed.
+ */
+public static void main(String[] args) throws Exception {
+MonitoringRowAttributeWalkerGenerator gen = new 
MonitoringRowAttributeWalkerGenerator();
+
+gen.generateAndWrite(CacheGroupView.class, DFLT_SRC_DIR);
+gen.generateAndWrite(CacheView.class, DFLT_SRC_DIR);
+gen.generateAndWrite(ServiceView.class, DFLT_SRC_DIR);
+gen.generateAndWrite(ComputeTaskView.class, DFLT_SRC_DIR);
+}
+
+/**
+ * Generates {@link MonitoringRowAttributeWalker} implementation and write 
it to the file.
+ *
+ * @param clazz Class to geneare {@link MonitoringRowAttributeWalker} for.
+ * @param srcRoot Source root folder.
+ * @param  type of the {@link MonitoringRow}.
+ * @throws IOException If generation failed.
+ */
+private > void generateAndWrite(Class clazz, 
String srcRoot) throws IOException {
+File walkerClass = new File(srcRoot + '/' + 
WALKER_PACKAGE.replaceAll("\\.", "/") + '/' +
+clazz.getSimpleName() + "Walker.java");
+
+Collection code = generate(clazz);
+
+walkerClass.createNewFile();
+
+try (FileWriter writer = new FileWriter(walkerClass)) {
+for (String line : code) {
+writer.write(line);
+writer.write('\n');
+}
+}
+}
+
+/**
+ * Generates {@link MonitoringRowAttributeWalker} implementation.
+ *
+ * @param clazz Class to geneare {@link MonitoringRowAttributeWalker} for.
+ * @param  type of the {@link MonitoringRow}.
+ * @return Java source code of the {@link MonitoringRowAttributeWalker} 
implementation.
+ */
+private > Collection generate(Class 
clazz) {
+final List code = new ArrayList<>();
+final Set imports = new TreeSet<>();
+
+

[GitHub] [ignite] alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: Monitoring list engine.

2019-09-09 Thread GitBox
alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: 
Monitoring list engine.
URL: https://github.com/apache/ignite/pull/6845#discussion_r321753976
 
 

 ##
 File path: 
modules/codegen/src/main/java/org/apache/ignite/codegen/MonitoringRowAttributeWalkerGenerator.java
 ##
 @@ -0,0 +1,283 @@
+/*
+ * 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.codegen;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.TreeSet;
+import java.util.function.ObjIntConsumer;
+import org.apache.ignite.internal.processors.metric.list.walker.Order;
+import org.apache.ignite.spi.metric.jmx.MonitoringListMBean;
+import org.apache.ignite.spi.metric.list.MonitoringList;
+import org.apache.ignite.spi.metric.list.MonitoringRow;
+import org.apache.ignite.spi.metric.list.MonitoringRowAttributeWalker;
+import org.apache.ignite.spi.metric.list.view.CacheGroupView;
+import org.apache.ignite.spi.metric.list.view.CacheView;
+import org.apache.ignite.spi.metric.list.view.ComputeTaskView;
+import org.apache.ignite.spi.metric.list.view.ServiceView;
+
+import static org.apache.ignite.codegen.MessageCodeGenerator.DFLT_SRC_DIR;
+import static org.apache.ignite.codegen.MessageCodeGenerator.TAB;
+
+/**
+ * Application for code generation of {@link MonitoringRowAttributeWalker}.
+ * Usage: simply run main method from Ignite source folder(using IDE or other 
way).
+ * Generated code used in {@link MonitoringList}.
+ *
+ * @see MonitoringListMBean
+ * @see MonitoringListLocalSystemView
 
 Review comment:
   Class not imported


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [ignite] alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: Monitoring list engine.

2019-09-09 Thread GitBox
alex-plekhanov commented on a change in pull request #6845: IGNITE-12145: 
Monitoring list engine.
URL: https://github.com/apache/ignite/pull/6845#discussion_r321754188
 
 

 ##
 File path: 
modules/codegen/src/main/java/org/apache/ignite/codegen/MonitoringRowAttributeWalkerGenerator.java
 ##
 @@ -0,0 +1,283 @@
+/*
+ * 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.codegen;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.TreeSet;
+import java.util.function.ObjIntConsumer;
+import org.apache.ignite.internal.processors.metric.list.walker.Order;
+import org.apache.ignite.spi.metric.jmx.MonitoringListMBean;
+import org.apache.ignite.spi.metric.list.MonitoringList;
+import org.apache.ignite.spi.metric.list.MonitoringRow;
+import org.apache.ignite.spi.metric.list.MonitoringRowAttributeWalker;
+import org.apache.ignite.spi.metric.list.view.CacheGroupView;
+import org.apache.ignite.spi.metric.list.view.CacheView;
+import org.apache.ignite.spi.metric.list.view.ComputeTaskView;
+import org.apache.ignite.spi.metric.list.view.ServiceView;
+
+import static org.apache.ignite.codegen.MessageCodeGenerator.DFLT_SRC_DIR;
+import static org.apache.ignite.codegen.MessageCodeGenerator.TAB;
+
+/**
+ * Application for code generation of {@link MonitoringRowAttributeWalker}.
+ * Usage: simply run main method from Ignite source folder(using IDE or other 
way).
+ * Generated code used in {@link MonitoringList}.
+ *
+ * @see MonitoringListMBean
+ * @see MonitoringListLocalSystemView
+ */
+public class MonitoringRowAttributeWalkerGenerator {
+/** Methods that should be excluded from specific {@link 
MonitoringRowAttributeWalker}. */
+private static final Set SYS_METHODS = new 
HashSet<>(Arrays.asList("equals", "hashCode", "toString",
+"getClass", "monitoringRowId"));
+
+/** Package for {@link MonitoringRowAttributeWalker} implementations. */
+public static final String WALKER_PACKAGE = 
"org.apache.ignite.internal.processors.metric.list.walker";
+
+/**
+ * @throws Exception If generation failed.
+ */
+public static void main(String[] args) throws Exception {
+MonitoringRowAttributeWalkerGenerator gen = new 
MonitoringRowAttributeWalkerGenerator();
+
+gen.generateAndWrite(CacheGroupView.class, DFLT_SRC_DIR);
+gen.generateAndWrite(CacheView.class, DFLT_SRC_DIR);
+gen.generateAndWrite(ServiceView.class, DFLT_SRC_DIR);
+gen.generateAndWrite(ComputeTaskView.class, DFLT_SRC_DIR);
+}
+
+/**
+ * Generates {@link MonitoringRowAttributeWalker} implementation and write 
it to the file.
+ *
+ * @param clazz Class to geneare {@link MonitoringRowAttributeWalker} for.
+ * @param srcRoot Source root folder.
+ * @param  type of the {@link MonitoringRow}.
+ * @throws IOException If generation failed.
+ */
+private > void generateAndWrite(Class clazz, 
String srcRoot) throws IOException {
+File walkerClass = new File(srcRoot + '/' + 
WALKER_PACKAGE.replaceAll("\\.", "/") + '/' +
+clazz.getSimpleName() + "Walker.java");
+
+Collection code = generate(clazz);
+
+walkerClass.createNewFile();
+
+try (FileWriter writer = new FileWriter(walkerClass)) {
+for (String line : code) {
+writer.write(line);
+writer.write('\n');
+}
+}
+}
+
+/**
+ * Generates {@link MonitoringRowAttributeWalker} implementation.
+ *
+ * @param clazz Class to geneare {@link MonitoringRowAttributeWalker} for.
+ * @param  type of the {@link MonitoringRow}.
+ * @return Java source code of the {@link MonitoringRowAttributeWalker} 
implementation.
+ */
+private > Collection generate(Class 
clazz) {
+final List code = new ArrayList<>();
+final Set imports = new TreeSet<>();
+
+