This is an automated email from the ASF dual-hosted git repository.
nizhikov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git
The following commit(s) were added to refs/heads/master by this push:
new d49898ea1d8 IGNITE-18226 Remove of CacheGroupMetricsMXBean (#10391)
d49898ea1d8 is described below
commit d49898ea1d8ac8f8fa514f702ebe1c9f119c8b29
Author: Nikolay <[email protected]>
AuthorDate: Tue Nov 22 19:43:42 2022 +0300
IGNITE-18226 Remove of CacheGroupMetricsMXBean (#10391)
---
.../processors/cache/CacheGroupMetricsImpl.java | 8 +
.../cache/CacheGroupMetricsMXBeanImpl.java | 183 ------------------
.../processors/cache/GridCacheProcessor.java | 24 ---
.../ignite/mxbean/CacheGroupMetricsMXBean.java | 212 ---------------------
.../processors/cache/CacheGroupMetricsTest.java | 90 ++++-----
.../processors/cache/CacheMetricsManageTest.java | 2 +-
.../cache/CacheGroupMetricsWithIndexTest.java | 10 +-
7 files changed, 53 insertions(+), 476 deletions(-)
diff --git
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheGroupMetricsImpl.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheGroupMetricsImpl.java
index ced091dbc93..eac03b8ecd3 100644
---
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheGroupMetricsImpl.java
+++
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheGroupMetricsImpl.java
@@ -175,6 +175,14 @@ public class CacheGroupMetricsImpl {
this::getTotalAllocatedSize,
"Total size of memory allocated for group, in bytes.");
+ mreg.register("ClusterOwningPartitionsCount",
+ this::getClusterOwningPartitionsCount,
+ "Count of partitions for this cache group in the entire cluster
with state OWNING.");
+
+ mreg.register("ClusterMovingPartitionsCount",
+ this::getClusterMovingPartitionsCount,
+ "Count of partitions for this cache group in the entire cluster
with state MOVING.");
+
if (ctx.config().isEncryptionEnabled()) {
mreg.register("ReencryptionFinished",
() ->
!ctx.shared().kernalContext().encryption().reencryptionInProgress(ctx.groupId()),
diff --git
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheGroupMetricsMXBeanImpl.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheGroupMetricsMXBeanImpl.java
deleted file mode 100644
index a25f25a7208..00000000000
---
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheGroupMetricsMXBeanImpl.java
+++ /dev/null
@@ -1,183 +0,0 @@
-/*
- * 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.cache;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import org.apache.ignite.cache.CacheMode;
-import org.apache.ignite.mxbean.CacheGroupMetricsMXBean;
-import org.apache.ignite.spi.metric.MetricExporterSpi;
-import org.apache.ignite.spi.metric.ReadOnlyMetricManager;
-import org.apache.ignite.spi.metric.ReadOnlyMetricRegistry;
-import org.apache.ignite.spi.metric.jmx.JmxMetricExporterSpi;
-
-/**
- * Management bean that provides access to {@link CacheGroupContext}.
- *
- * @deprecated Check the {@link JmxMetricExporterSpi} with
"name=cacheGroups.{cache_group_name}" instead.
- *
- * @see ReadOnlyMetricManager
- * @see ReadOnlyMetricRegistry
- * @see JmxMetricExporterSpi
- * @see MetricExporterSpi
- */
-@Deprecated
-public class CacheGroupMetricsMXBeanImpl implements CacheGroupMetricsMXBean {
- /** Cache group context. */
- private final CacheGroupContext ctx;
-
- /** Cache group metrics. */
- private final CacheGroupMetricsImpl metrics;
-
- /**
- * Creates Group metrics MBean.
- *
- * @param ctx Cache group context.
- */
- public CacheGroupMetricsMXBeanImpl(CacheGroupContext ctx) {
- this.ctx = ctx;
- this.metrics = ctx.metrics();
- }
-
- /** {@inheritDoc} */
- @Override public int getGroupId() {
- return ctx.groupId();
- }
-
- /** {@inheritDoc} */
- @Override public String getGroupName() {
- return ctx.name();
- }
-
- /** {@inheritDoc} */
- @Override public List<String> getCaches() {
- List<String> caches = new ArrayList<>(ctx.caches().size());
-
- for (GridCacheContext cache : ctx.caches())
- caches.add(cache.name());
-
- Collections.sort(caches);
-
- return caches;
- }
-
- /** {@inheritDoc} */
- @Override public int getBackups() {
- return ctx.config().getBackups();
- }
-
- /** {@inheritDoc} */
- @Override public int getPartitions() {
- return ctx.topology().partitions();
- }
-
- /** {@inheritDoc} */
- @Override public int getMinimumNumberOfPartitionCopies() {
- return metrics.getMinimumNumberOfPartitionCopies();
- }
-
- /** {@inheritDoc} */
- @Override public int getMaximumNumberOfPartitionCopies() {
- return metrics.getMaximumNumberOfPartitionCopies();
- }
-
- /** {@inheritDoc} */
- @Override public int getLocalNodeOwningPartitionsCount() {
- return metrics.getLocalNodeOwningPartitionsCount();
- }
-
- /** {@inheritDoc} */
- @Override public int getLocalNodeMovingPartitionsCount() {
- return metrics.getLocalNodeMovingPartitionsCount();
- }
-
- /** {@inheritDoc} */
- @Override public int getLocalNodeRentingPartitionsCount() {
- return metrics.getLocalNodeRentingPartitionsCount();
- }
-
- /** {@inheritDoc} */
- @Override public long getLocalNodeRentingEntriesCount() {
- return metrics.getLocalNodeRentingEntriesCount();
- }
-
- /** {@inheritDoc} */
- @Override public int getClusterOwningPartitionsCount() {
- return metrics.getClusterOwningPartitionsCount();
- }
-
- /** {@inheritDoc} */
- @Override public int getClusterMovingPartitionsCount() {
- return metrics.getClusterMovingPartitionsCount();
- }
-
- /** {@inheritDoc} */
- @Override public Map<Integer, Set<String>>
getOwningPartitionsAllocationMap() {
- return metrics.getOwningPartitionsAllocationMap();
- }
-
- /** {@inheritDoc} */
- @Override public Map<Integer, Set<String>>
getMovingPartitionsAllocationMap() {
- return metrics.getMovingPartitionsAllocationMap();
- }
-
- /** {@inheritDoc} */
- @Override public Map<Integer, List<String>>
getAffinityPartitionsAssignmentMap() {
- return metrics.getAffinityPartitionsAssignmentMap();
- }
-
- /** {@inheritDoc} */
- @Override public String getType() {
- CacheMode type = ctx.config().getCacheMode();
-
- return String.valueOf(type);
- }
-
- /** {@inheritDoc} */
- @Override public List<Integer> getPartitionIds() {
- return metrics.getPartitionIds();
- }
-
- /** {@inheritDoc} */
- @Override public long getTotalAllocatedPages() {
- return metrics.getTotalAllocatedPages();
- }
-
- /** {@inheritDoc} */
- @Override public long getTotalAllocatedSize() {
- return metrics.getTotalAllocatedSize();
- }
-
- /** {@inheritDoc} */
- @Override public long getStorageSize() {
- return metrics.getStorageSize();
- }
-
- /** {@inheritDoc} */
- @Override public long getSparseStorageSize() {
- return metrics.getSparseStorageSize();
- }
-
- /** {@inheritDoc} */
- @Override public long getIndexBuildCountPartitionsLeft() {
- return metrics.getIndexBuildCountPartitionsLeft();
- }
-}
diff --git
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
index 22b66b4787d..2d721e27d3a 100644
---
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
+++
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
@@ -182,7 +182,6 @@ import org.apache.ignite.lang.IgniteUuid;
import org.apache.ignite.lifecycle.LifecycleAware;
import org.apache.ignite.marshaller.Marshaller;
import org.apache.ignite.marshaller.MarshallerUtils;
-import org.apache.ignite.mxbean.CacheGroupMetricsMXBean;
import org.apache.ignite.mxbean.IgniteMBeanAware;
import org.apache.ignite.plugin.security.SecurityException;
import org.apache.ignite.plugin.security.SecurityPermission;
@@ -268,9 +267,6 @@ public class GridCacheProcessor extends
GridProcessorAdapter {
private final boolean keepStaticCacheConfiguration =
IgniteSystemProperties.getBoolean(
IgniteSystemProperties.IGNITE_KEEP_STATIC_CACHE_CONFIGURATION);
- /** MBean group for cache group metrics */
- private static final String CACHE_GRP_METRICS_MBEAN_GRP = "Cache groups";
-
/**
* Initial timeout (in milliseconds) for output the progress of restoring
partitions status.
* After the first output, the next ones will be output after value/5.
@@ -559,16 +555,6 @@ public class GridCacheProcessor extends
GridProcessorAdapter {
for (Object obj : grp.configuredUserObjects())
cleanup(cfg, obj, false);
- if (!grp.systemCache() && !U.IGNITE_MBEANS_DISABLED) {
- try {
-
ctx.config().getMBeanServer().unregisterMBean(U.makeMBeanName(ctx.igniteInstanceName(),
- CACHE_GRP_METRICS_MBEAN_GRP, grp.cacheOrGroupName()));
- }
- catch (Throwable e) {
- U.error(log, "Failed to unregister MBean for cache group: " +
grp.name(), e);
- }
- }
-
grp.metrics().remove(destroy);
grp.removeIOStatistic(destroy);
@@ -2522,16 +2508,6 @@ public class GridCacheProcessor extends
GridProcessorAdapter {
CacheGroupContext old = cacheGrps.put(desc.groupId(), grp);
- if (!grp.systemCache() && !U.IGNITE_MBEANS_DISABLED) {
- try {
- U.registerMBean(ctx.config().getMBeanServer(),
ctx.igniteInstanceName(), CACHE_GRP_METRICS_MBEAN_GRP,
- grp.cacheOrGroupName(), new
CacheGroupMetricsMXBeanImpl(grp), CacheGroupMetricsMXBean.class);
- }
- catch (Throwable e) {
- U.error(log, "Failed to register MBean for cache group: " +
grp.name(), e);
- }
- }
-
assert old == null : old.name();
return grp;
diff --git
a/modules/core/src/main/java/org/apache/ignite/mxbean/CacheGroupMetricsMXBean.java
b/modules/core/src/main/java/org/apache/ignite/mxbean/CacheGroupMetricsMXBean.java
deleted file mode 100644
index af3b69a5cbf..00000000000
---
a/modules/core/src/main/java/org/apache/ignite/mxbean/CacheGroupMetricsMXBean.java
+++ /dev/null
@@ -1,212 +0,0 @@
-/*
- * 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.mxbean;
-
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import org.apache.ignite.internal.processors.cache.CacheGroupContext;
-import org.apache.ignite.spi.metric.MetricExporterSpi;
-import org.apache.ignite.spi.metric.ReadOnlyMetricRegistry;
-import org.apache.ignite.spi.metric.jmx.JmxMetricExporterSpi;
-
-/**
- * This interface defines JMX view on {@link CacheGroupContext}.
- *
- * @deprecated Check the {@link JmxMetricExporterSpi} with
"name=cacheGroups.{cache_group_name}" instead.
- *
- * @see ReadOnlyMetricRegistry
- * @see JmxMetricExporterSpi
- * @see MetricExporterSpi
- */
-@Deprecated
-@MXBeanDescription("MBean that provides access to cache group descriptor.")
-public interface CacheGroupMetricsMXBean {
- /**
- * Gets cache group id.
- *
- * @return Cache group id.
- */
- @MXBeanDescription("Cache group id.")
- public int getGroupId();
-
- /**
- * Gets cache group name.
- *
- * @return Cache group name.
- */
- @MXBeanDescription("Cache group name.")
- public String getGroupName();
-
- /**
- * Gets list of cache names of this cache group.
- *
- * @return List of cache names.
- */
- @MXBeanDescription("List of caches.")
- public List<String> getCaches();
-
- /**
- * Gets count of backups configured for this cache group.
- *
- * @return Count of backups.
- */
- @MXBeanDescription("Count of backups configured for cache group.")
- public int getBackups();
-
- /**
- * Gets count of partitions for this cache group.
- *
- * @return Count of partitions.
- */
- @MXBeanDescription("Count of partitions for cache group.")
- public int getPartitions();
-
- /**
- * Calculates minimum number of partitions copies for all partitions of
this cache group.
- *
- * @return Minimum number of copies.
- */
- @MXBeanDescription("Minimum number of partition copies for all partitions
of this cache group.")
- public int getMinimumNumberOfPartitionCopies();
-
- /**
- * Calculates maximum number of partitions copies for all partitions of
this cache group.
- *
- * @return Maximum number of copies.
- */
- @MXBeanDescription("Maximum number of partition copies for all partitions
of this cache group.")
- public int getMaximumNumberOfPartitionCopies();
-
- /**
- * Gets count of partitions with state OWNING for this cache group located
on this node.
- *
- * @return Partitions count.
- */
- @MXBeanDescription("Count of partitions with state OWNING for this cache
group located on this node.")
- public int getLocalNodeOwningPartitionsCount();
-
- /**
- * Gets count of partitions with state MOVING for this cache group located
on this node.
- *
- * @return Partitions count.
- */
- @MXBeanDescription("Count of partitions with state MOVING for this cache
group located on this node.")
- public int getLocalNodeMovingPartitionsCount();
-
- /**
- * Gets count of partitions with state RENTING for this cache group
located on this node.
- *
- * @return Partitions count.
- */
- @MXBeanDescription("Count of partitions with state RENTING for this cache
group located on this node.")
- public int getLocalNodeRentingPartitionsCount();
-
- /**
- * Gets count of entries remains to evict in RENTING partitions located on
this node for this cache group.
- *
- * @return Entries count.
- */
- @MXBeanDescription("Count of entries remains to evict in RENTING
partitions located on this node for this cache group.")
- public long getLocalNodeRentingEntriesCount();
-
- /**
- * Gets count of partitions with state OWNING for this cache group in the
entire cluster.
- *
- * @return Partitions count.
- */
- @MXBeanDescription("Count of partitions for this cache group in the entire
cluster with state OWNING.")
- public int getClusterOwningPartitionsCount();
-
- /**
- * Gets count of partitions with state MOVING for this cache group in the
entire cluster.
- *
- * @return Partitions count.
- */
- @MXBeanDescription("Count of partitions for this cache group in the entire
cluster with state MOVING.")
- public int getClusterMovingPartitionsCount();
-
- /**
- * Gets allocation map of partitions with state OWNING in the cluster.
- *
- * @return Map from partition number to set of nodes, where partition is
located.
- */
- @MXBeanDescription("Allocation map of partitions with state OWNING in the
cluster.")
- public Map<Integer, Set<String>> getOwningPartitionsAllocationMap();
-
- /**
- * Gets allocation map of partitions with state MOVING in the cluster.
- *
- * @return Map from partition number to set of nodes, where partition is
located
- */
- @MXBeanDescription("Allocation map of partitions with state MOVING in the
cluster.")
- public Map<Integer, Set<String>> getMovingPartitionsAllocationMap();
-
- /**
- * Gets affinity partitions assignment map.
- *
- * @return Map from partition number to list of nodes. The first node in
this list is where the PRIMARY partition is
- * assigned, other nodes in the list is where the BACKUP partitions is
assigned.
- */
- @MXBeanDescription("Affinity partitions assignment map.")
- public Map<Integer, List<String>> getAffinityPartitionsAssignmentMap();
-
- /**
- * @return Cache group type.
- */
- @MXBeanDescription("Cache group type.")
- public String getType();
-
- /**
- * @return Local partition ids..
- */
- @MXBeanDescription("Local partition ids.")
- public List<Integer> getPartitionIds();
-
- /**
- * @return Cache group total allocated pages.
- */
- @MXBeanDescription("Cache group total allocated pages.")
- public long getTotalAllocatedPages();
-
- /**
- * @return Total size of memory allocated for group, in bytes.
- */
- @MXBeanDescription("Total size of memory allocated for group, in bytes.")
- public long getTotalAllocatedSize();
-
- /**
- * @return Storage space allocated for group, in bytes.
- */
- @MXBeanDescription("Storage space allocated for group, in bytes.")
- public long getStorageSize();
-
- /**
- * @return Storage space allocated for group adjusted for possible
sparsity, in bytes.
- */
- @MXBeanDescription("Storage space allocated for group adjusted for
possible sparsity, in bytes.")
- public long getSparseStorageSize();
-
- /**
- * @return Number of partitions need processed for finished indexes create
or rebuilding.
- * It is calculated as the number of local partition minus the processed.
- * A value of 0 indicates that the index is built.
- */
- @MXBeanDescription("Count of partitions need processed for finished
indexes create or rebuilding.")
- public long getIndexBuildCountPartitionsLeft();
-}
diff --git
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGroupMetricsTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGroupMetricsTest.java
index 8270d911b54..4e355e4158d 100644
---
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGroupMetricsTest.java
+++
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGroupMetricsTest.java
@@ -49,9 +49,7 @@ import
org.apache.ignite.internal.processors.metric.MetricRegistry;
import org.apache.ignite.internal.processors.metric.impl.AtomicLongMetric;
import org.apache.ignite.internal.util.lang.GridAbsPredicate;
import org.apache.ignite.internal.util.typedef.F;
-import org.apache.ignite.internal.util.typedef.T2;
import org.apache.ignite.lang.IgnitePredicate;
-import org.apache.ignite.mxbean.CacheGroupMetricsMXBean;
import org.apache.ignite.spi.metric.IntMetric;
import org.apache.ignite.spi.metric.LongMetric;
import org.apache.ignite.spi.metric.Metric;
@@ -199,17 +197,14 @@ public class CacheGroupMetricsTest extends
GridCommonAbstractTest implements Ser
}
/**
- * Gets CacheGroupMetricsMXBean for given node and group name.
+ * Gets cache group metrics for given node and group name.
*
* @param nodeIdx Node index.
* @param cacheOrGrpName Cache group name.
- * @return MBean instance and MetricRegistry for the specified group.
+ * @return MetricRegistry for the specified group.
*/
- protected T2<CacheGroupMetricsMXBean, MetricRegistry>
cacheGroupMetrics(int nodeIdx, String cacheOrGrpName) {
- return new T2<>(
- getMxBean(getTestIgniteInstanceName(nodeIdx), "Cache groups",
cacheOrGrpName, CacheGroupMetricsMXBean.class),
-
grid(nodeIdx).context().metric().registry(metricName(CACHE_GROUP_METRICS_PREFIX,
cacheOrGrpName))
- );
+ protected MetricRegistry cacheGroupMetrics(int nodeIdx, String
cacheOrGrpName) {
+ return
grid(nodeIdx).context().metric().registry(metricName(CACHE_GROUP_METRICS_PREFIX,
cacheOrGrpName));
}
/**
@@ -269,43 +264,36 @@ public class CacheGroupMetricsTest extends
GridCommonAbstractTest implements Ser
awaitPartitionMapExchange(true, false, null);
- T2<CacheGroupMetricsMXBean, MetricRegistry> mxBean0Grp1 =
cacheGroupMetrics(0, "group1");
- T2<CacheGroupMetricsMXBean, MetricRegistry> mxBean0Grp2 =
cacheGroupMetrics(0, "group2");
- T2<CacheGroupMetricsMXBean, MetricRegistry> mxBean0Grp3 =
cacheGroupMetrics(0, "cache4");
- T2<CacheGroupMetricsMXBean, MetricRegistry> mxBean1Grp1 =
cacheGroupMetrics(1, "group1");
- T2<CacheGroupMetricsMXBean, MetricRegistry> mxBean2Grp1 =
cacheGroupMetrics(2, "group1");
+ MetricRegistry mxBean0Grp1 = cacheGroupMetrics(0, "group1");
+ MetricRegistry mxBean0Grp2 = cacheGroupMetrics(0, "group2");
+ MetricRegistry mxBean0Grp3 = cacheGroupMetrics(0, "cache4");
+ MetricRegistry mxBean1Grp1 = cacheGroupMetrics(1, "group1");
+ MetricRegistry mxBean2Grp1 = cacheGroupMetrics(2, "group1");
- assertEquals("group1", mxBean0Grp1.get1().getGroupName());
- assertEquals(null, mxBean0Grp3.get1().getGroupName());
+ assertEquals(1,
mxBean0Grp1.<IntMetric>findMetric("MinimumNumberOfPartitionCopies").value());
+ assertEquals(3,
mxBean0Grp1.<IntMetric>findMetric("MaximumNumberOfPartitionCopies").value());
- assertEquals(3, mxBean0Grp1.get1().getBackups());
+ assertEquals(0,
mxBean0Grp1.<IntMetric>findMetric("ClusterMovingPartitionsCount").value());
+ assertEquals(19,
mxBean0Grp1.<IntMetric>findMetric("ClusterOwningPartitionsCount").value());
- assertEquals(10, mxBean0Grp1.get1().getPartitions());
-
- assertEquals(1,
mxBean0Grp1.get2().<IntMetric>findMetric("MinimumNumberOfPartitionCopies").value());
- assertEquals(3,
mxBean0Grp1.get2().<IntMetric>findMetric("MaximumNumberOfPartitionCopies").value());
-
- assertEquals(0, mxBean0Grp1.get1().getClusterMovingPartitionsCount());
- assertEquals(19, mxBean0Grp1.get1().getClusterOwningPartitionsCount());
-
- assertEquals(7,
mxBean0Grp1.get2().<IntMetric>findMetric("LocalNodeOwningPartitionsCount").value());
- assertEquals(6,
mxBean1Grp1.get2().<IntMetric>findMetric("LocalNodeOwningPartitionsCount").value());
- assertEquals(6,
mxBean2Grp1.get2().<IntMetric>findMetric("LocalNodeOwningPartitionsCount").value());
+ assertEquals(7,
mxBean0Grp1.<IntMetric>findMetric("LocalNodeOwningPartitionsCount").value());
+ assertEquals(6,
mxBean1Grp1.<IntMetric>findMetric("LocalNodeOwningPartitionsCount").value());
+ assertEquals(6,
mxBean2Grp1.<IntMetric>findMetric("LocalNodeOwningPartitionsCount").value());
assertEquals(F.asList("cache1"),
-
mxBean0Grp1.get2().<ObjectMetric<List<String>>>findMetric("Caches").value());
+
mxBean0Grp1.<ObjectMetric<List<String>>>findMetric("Caches").value());
assertEquals(F.asList("cache2", "cache3"),
-
mxBean0Grp2.get2().<ObjectMetric<List<String>>>findMetric("Caches").value());
+
mxBean0Grp2.<ObjectMetric<List<String>>>findMetric("Caches").value());
assertEquals(F.asList("cache4"),
-
mxBean0Grp3.get2().<ObjectMetric<List<String>>>findMetric("Caches").value());
+
mxBean0Grp3.<ObjectMetric<List<String>>>findMetric("Caches").value());
- assertEquals(arrayToAssignmentMap(assignmentMapArr), mxBean0Grp1.get2()
+ assertEquals(arrayToAssignmentMap(assignmentMapArr), mxBean0Grp1
.<ObjectMetric<Map<Integer,
List<String>>>>findMetric("AffinityPartitionsAssignmentMap").value());
- assertEquals(arrayToAllocationMap(assignmentMapArr), mxBean0Grp1.get2()
+ assertEquals(arrayToAllocationMap(assignmentMapArr), mxBean0Grp1
.<ObjectMetric<Map<Integer,
List<String>>>>findMetric("OwningPartitionsAllocationMap").value());
ObjectMetric<Map<Integer, List<String>>> movingPartitionsAllocationMap
=
- mxBean0Grp1.get2().findMetric("MovingPartitionsAllocationMap");
+ mxBean0Grp1.findMetric("MovingPartitionsAllocationMap");
assertEquals(arrayToAllocationMap(new int[10][]),
movingPartitionsAllocationMap.value());
@@ -323,10 +311,10 @@ public class CacheGroupMetricsTest extends
GridCommonAbstractTest implements Ser
// Check moving partitions while rebalancing.
assertFalse(arrayToAllocationMap(new
int[10][]).equals(movingPartitionsAllocationMap.value()));
- int movingCnt =
mxBean0Grp1.get2().<IntMetric>findMetric("LocalNodeMovingPartitionsCount").value();
+ int movingCnt =
mxBean0Grp1.<IntMetric>findMetric("LocalNodeMovingPartitionsCount").value();
assertTrue(movingCnt > 0);
- assertTrue(mxBean0Grp1.get1().getClusterMovingPartitionsCount() > 0);
+
assertTrue(mxBean0Grp1.<IntMetric>findMetric("ClusterMovingPartitionsCount").value()
> 0);
final CountDownLatch evictLatch = new CountDownLatch(1);
@@ -354,12 +342,12 @@ public class CacheGroupMetricsTest extends
GridCommonAbstractTest implements Ser
GridTestUtils.waitForCondition(new GridAbsPredicate() {
@Override public boolean apply() {
IntMetric localNodeRentingPartitionsCount =
-
mxBean0Grp1.get2().findMetric("LocalNodeRentingPartitionsCount");
+
mxBean0Grp1.findMetric("LocalNodeRentingPartitionsCount");
log.info("Renting partitions count: " +
localNodeRentingPartitionsCount.value());
log.info("Renting entries count: " +
-
mxBean0Grp1.get2().findMetric("LocalNodeRentingEntriesCount").getAsString());
+
mxBean0Grp1.findMetric("LocalNodeRentingEntriesCount").getAsString());
return localNodeRentingPartitionsCount.value() ==
movingCnt;
}
@@ -367,7 +355,7 @@ public class CacheGroupMetricsTest extends
GridCommonAbstractTest implements Ser
);
assertTrue("Renting entries count is 0",
-
mxBean0Grp1.get2().<IntMetric>findMetric("LocalNodeRentingPartitionsCount").value()
> 0);
+
mxBean0Grp1.<IntMetric>findMetric("LocalNodeRentingPartitionsCount").value() >
0);
}
finally {
evictLatch.countDown();
@@ -387,9 +375,9 @@ public class CacheGroupMetricsTest extends
GridCommonAbstractTest implements Ser
ignite.cluster().active(true);
- T2<CacheGroupMetricsMXBean, MetricRegistry> mxBean0Grp1 =
cacheGroupMetrics(0, "group1");
- T2<CacheGroupMetricsMXBean, MetricRegistry> mxBean0Grp2 =
cacheGroupMetrics(0, "group2");
- T2<CacheGroupMetricsMXBean, MetricRegistry> mxBean0Grp3 =
cacheGroupMetrics(0, "cache4");
+ MetricRegistry mxBean0Grp1 = cacheGroupMetrics(0, "group1");
+ MetricRegistry mxBean0Grp2 = cacheGroupMetrics(0, "group2");
+ MetricRegistry mxBean0Grp3 = cacheGroupMetrics(0, "cache4");
GridMetricManager mmgr = ignite.context().metric();
@@ -397,9 +385,9 @@ public class CacheGroupMetricsTest extends
GridCommonAbstractTest implements Ser
.findMetric("TotalAllocatedPages");
assertEquals(totalPages.value(),
-
mxBean0Grp1.get2().<LongMetric>findMetric("TotalAllocatedPages").value() +
-
mxBean0Grp2.get2().<LongMetric>findMetric("TotalAllocatedPages").value() +
-
mxBean0Grp3.get2().<LongMetric>findMetric("TotalAllocatedPages").value());
+ mxBean0Grp1.<LongMetric>findMetric("TotalAllocatedPages").value() +
+ mxBean0Grp2.<LongMetric>findMetric("TotalAllocatedPages").value() +
+ mxBean0Grp3.<LongMetric>findMetric("TotalAllocatedPages").value());
for (int cacheIdx = 1; cacheIdx <= 4; cacheIdx++) {
IgniteCache cache = ignite.cache("cache" + cacheIdx);
@@ -409,9 +397,9 @@ public class CacheGroupMetricsTest extends
GridCommonAbstractTest implements Ser
}
assertEquals(totalPages.value(),
-
mxBean0Grp1.get2().<LongMetric>findMetric("TotalAllocatedPages").value() +
-
mxBean0Grp2.get2().<LongMetric>findMetric("TotalAllocatedPages").value() +
-
mxBean0Grp3.get2().<LongMetric>findMetric("TotalAllocatedPages").value());
+ mxBean0Grp1.<LongMetric>findMetric("TotalAllocatedPages").value() +
+ mxBean0Grp2.<LongMetric>findMetric("TotalAllocatedPages").value() +
+ mxBean0Grp3.<LongMetric>findMetric("TotalAllocatedPages").value());
}
/**
@@ -457,9 +445,9 @@ public class CacheGroupMetricsTest extends
GridCommonAbstractTest implements Ser
String[] names = new String[] {"group1", "group2", "cache4"};
for (String name : names) {
- T2<CacheGroupMetricsMXBean, MetricRegistry> grp1 =
cacheGroupMetrics(1, name);
+ MetricRegistry grp1 = cacheGroupMetrics(1, name);
- for (Metric metric : grp1.get2())
+ for (Metric metric : grp1)
metric.getAsString();
}
@@ -485,7 +473,7 @@ public class CacheGroupMetricsTest extends
GridCommonAbstractTest implements Ser
ignite.cluster().active(true);
- MetricRegistry group1Metrics = cacheGroupMetrics(0, "group1").get2();
+ MetricRegistry group1Metrics = cacheGroupMetrics(0, "group1");
AtomicLongMetric locPartsNum =
group1Metrics.findMetric("InitializedLocalPartitionsNumber");
diff --git
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheMetricsManageTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheMetricsManageTest.java
index 6ef740b2e54..53de990d014 100644
---
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheMetricsManageTest.java
+++
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheMetricsManageTest.java
@@ -505,7 +505,7 @@ public class CacheMetricsManageTest extends
GridCommonAbstractTest {
}
/**
- * Gets CacheGroupMetricsMXBean for given node and group name.
+ * Gets CacheMetricsMXBean for given node and group name.
*
* @param nodeIdx Node index.
* @param cacheName Cache name.
diff --git
a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheGroupMetricsWithIndexTest.java
b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheGroupMetricsWithIndexTest.java
index 8e6264851db..ad9c9941450 100644
---
a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheGroupMetricsWithIndexTest.java
+++
b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheGroupMetricsWithIndexTest.java
@@ -161,7 +161,7 @@ public class CacheGroupMetricsWithIndexTest extends
CacheGroupMetricsTest {
ignite.cluster().active(true);
- MetricRegistry metrics = cacheGroupMetrics(0, GROUP_NAME).get2();
+ MetricRegistry metrics = cacheGroupMetrics(0, GROUP_NAME);
LongMetric idxBuildCntPartitionsLeft =
metrics.findMetric("IndexBuildCountPartitionsLeft");
@@ -201,7 +201,7 @@ public class CacheGroupMetricsWithIndexTest extends
CacheGroupMetricsTest {
cache1.put(id, o.build());
}
- MetricRegistry metrics = cacheGroupMetrics(0, GROUP_NAME).get2();
+ MetricRegistry metrics = cacheGroupMetrics(0, GROUP_NAME);
GridTestUtils.runAsync(() -> {
String createIdxSql = "CREATE INDEX " + INDEX_NAME + " ON " +
TABLE + "(" + COLUMN3_NAME + ")";
@@ -274,7 +274,7 @@ public class CacheGroupMetricsWithIndexTest extends
CacheGroupMetricsTest {
startGrid(0);
- MetricRegistry metrics = cacheGroupMetrics(0, GROUP_NAME).get2();
+ MetricRegistry metrics = cacheGroupMetrics(0, GROUP_NAME);
LongMetric idxBuildCntPartitionsLeft =
metrics.findMetric("IndexBuildCountPartitionsLeft");
@@ -326,7 +326,7 @@ public class CacheGroupMetricsWithIndexTest extends
CacheGroupMetricsTest {
stopGrid(1);
- MetricRegistry metrics = cacheGroupMetrics(0, GROUP_NAME).get2();
+ MetricRegistry metrics = cacheGroupMetrics(0, GROUP_NAME);
GridTestUtils.runAsync(() -> {
String createIdxSql = "CREATE INDEX " + INDEX_NAME + " ON " +
TABLE + "(" + COLUMN3_NAME + ")";
@@ -350,7 +350,7 @@ public class CacheGroupMetricsWithIndexTest extends
CacheGroupMetricsTest {
startGrid(1);
- metrics = cacheGroupMetrics(1, GROUP_NAME).get2();
+ metrics = cacheGroupMetrics(1, GROUP_NAME);
final LongMetric idxBuildCntPartitionsLeft1 =
metrics.findMetric("IndexBuildCountPartitionsLeft");