use of org.apache.ignite.internal.processors.metric.MetricRegistry in project ignite by apache.
the class JmxExporterSpiTest method testHistogramExport.
/**
*/
@Test
public void testHistogramExport() throws Exception {
MetricRegistry mreg = ignite.context().metric().registry("histogramTest");
createTestHistogram(mreg);
DynamicMBean bean = metricRegistry(ignite.name(), null, "histogramTest");
MBeanAttributeInfo[] attrs = bean.getMBeanInfo().getAttributes();
assertEquals(6, attrs.length);
assertEquals(1L, bean.getAttribute("histogram_0_50"));
assertEquals(2L, bean.getAttribute("histogram_50_500"));
assertEquals(3L, bean.getAttribute("histogram_500_inf"));
assertEquals(1L, bean.getAttribute("histogram_with_underscore_0_50"));
assertEquals(2L, bean.getAttribute("histogram_with_underscore_50_500"));
assertEquals(3L, bean.getAttribute("histogram_with_underscore_500_inf"));
}
use of org.apache.ignite.internal.processors.metric.MetricRegistry in project ignite by apache.
the class JmxExporterSpiTest method testHistogramSearchByName.
/**
*/
@Test
public void testHistogramSearchByName() throws Exception {
MetricRegistry mreg = new MetricRegistry("test", name -> null, name -> null, null);
createTestHistogram(mreg);
assertEquals(Long.valueOf(1), searchHistogram("histogram_0_50", mreg));
assertEquals(Long.valueOf(2), searchHistogram("histogram_50_500", mreg));
assertEquals(Long.valueOf(3), searchHistogram("histogram_500_inf", mreg));
assertEquals(Long.valueOf(1), searchHistogram("histogram_with_underscore_0_50", mreg));
assertEquals(Long.valueOf(2), searchHistogram("histogram_with_underscore_50_500", mreg));
assertEquals(Long.valueOf(3), searchHistogram("histogram_with_underscore_500_inf", mreg));
assertNull(searchHistogram("unknown", mreg));
assertNull(searchHistogram("unknown_0", mreg));
assertNull(searchHistogram("unknown_0_50", mreg));
assertNull(searchHistogram("unknown_test", mreg));
assertNull(searchHistogram("unknown_test_test", mreg));
assertNull(searchHistogram("unknown_0_inf", mreg));
assertNull(searchHistogram("histogram", mreg));
assertNull(searchHistogram("histogram_0", mreg));
assertNull(searchHistogram("histogram_0_100", mreg));
assertNull(searchHistogram("histogram_0_inf", mreg));
assertNull(searchHistogram("histogram_0_500", mreg));
assertNull(searchHistogram("histogram_with_underscore", mreg));
assertNull(searchHistogram("histogram_with_underscore_0", mreg));
assertNull(searchHistogram("histogram_with_underscore_0_100", mreg));
assertNull(searchHistogram("histogram_with_underscore_0_inf", mreg));
assertNull(searchHistogram("histogram_with_underscore_0_500", mreg));
}
use of org.apache.ignite.internal.processors.metric.MetricRegistry in project ignite by apache.
the class JmxExporterSpiTest method testIgniteKernal.
/**
* @throws Exception If failed.
*/
@Test
public void testIgniteKernal() throws Exception {
DynamicMBean mbn = metricRegistry(ignite.name(), null, IGNITE_METRICS);
assertNotNull(mbn);
assertEquals(36, mbn.getMBeanInfo().getAttributes().length);
assertFalse(stream(mbn.getMBeanInfo().getAttributes()).anyMatch(a -> F.isEmpty(a.getDescription())));
assertFalse(F.isEmpty((String) mbn.getAttribute("fullVersion")));
assertFalse(F.isEmpty((String) mbn.getAttribute("copyright")));
assertFalse(F.isEmpty((String) mbn.getAttribute("osInformation")));
assertFalse(F.isEmpty((String) mbn.getAttribute("jdkInformation")));
assertFalse(F.isEmpty((String) mbn.getAttribute("vmName")));
assertFalse(F.isEmpty((String) mbn.getAttribute("discoverySpiFormatted")));
assertFalse(F.isEmpty((String) mbn.getAttribute("communicationSpiFormatted")));
assertFalse(F.isEmpty((String) mbn.getAttribute("deploymentSpiFormatted")));
assertFalse(F.isEmpty((String) mbn.getAttribute("checkpointSpiFormatted")));
assertFalse(F.isEmpty((String) mbn.getAttribute("collisionSpiFormatted")));
assertFalse(F.isEmpty((String) mbn.getAttribute("eventStorageSpiFormatted")));
assertFalse(F.isEmpty((String) mbn.getAttribute("failoverSpiFormatted")));
assertFalse(F.isEmpty((String) mbn.getAttribute("loadBalancingSpiFormatted")));
assertEquals(System.getProperty("user.name"), (String) mbn.getAttribute("osUser"));
assertNotNull(DateFormat.getDateTimeInstance().parse((String) mbn.getAttribute("startTimestampFormatted")));
assertNotNull(LocalTime.parse((String) mbn.getAttribute("uptimeFormatted")));
assertTrue((boolean) mbn.getAttribute("isRebalanceEnabled"));
assertTrue((boolean) mbn.getAttribute("isNodeInBaseline"));
assertTrue((boolean) mbn.getAttribute("active"));
assertTrue((long) mbn.getAttribute("startTimestamp") > 0);
assertTrue((long) mbn.getAttribute("uptime") > 0);
assertEquals(ignite.name(), (String) mbn.getAttribute("instanceName"));
assertEquals(Collections.emptyList(), mbn.getAttribute("userAttributesFormatted"));
assertEquals(Collections.emptyList(), mbn.getAttribute("lifecycleBeansFormatted"));
assertEquals(Collections.emptyMap(), mbn.getAttribute("longJVMPauseLastEvents"));
assertEquals(0L, mbn.getAttribute("longJVMPausesCount"));
assertEquals(0L, mbn.getAttribute("longJVMPausesTotalDuration"));
long clusterStateChangeTime = (long) mbn.getAttribute("lastClusterStateChangeTime");
assertTrue(0 < clusterStateChangeTime && clusterStateChangeTime < System.currentTimeMillis());
assertEquals(String.valueOf(ignite.configuration().getPublicThreadPoolSize()), mbn.getAttribute("executorServiceFormatted"));
assertEquals(ignite.configuration().isPeerClassLoadingEnabled(), mbn.getAttribute("isPeerClassLoadingEnabled"));
assertTrue(((String) mbn.getAttribute("currentCoordinatorFormatted")).contains(ignite.localNode().id().toString()));
assertEquals(ignite.configuration().getIgniteHome(), (String) mbn.getAttribute("igniteHome"));
assertEquals(ignite.localNode().id(), mbn.getAttribute("localNodeId"));
assertEquals(ignite.configuration().getGridLogger().toString(), (String) mbn.getAttribute("gridLoggerFormatted"));
assertEquals(ignite.configuration().getMBeanServer().toString(), (String) mbn.getAttribute("mBeanServerFormatted"));
assertEquals(ClusterState.ACTIVE.toString(), mbn.getAttribute("clusterState"));
}
use of org.apache.ignite.internal.processors.metric.MetricRegistry in project ignite by apache.
the class CacheMetricsAddRemoveTest method checkMetricsNotEmpty.
/**
*/
private void checkMetricsNotEmpty(String cachePrefix) {
for (int i = 0; i < 2; i++) {
GridMetricManager mmgr = metricManager(i);
MetricRegistry mreg = mmgr.registry(cachePrefix);
assertNotNull(mreg.findMetric(CACHE_GETS));
assertNotNull(mreg.findMetric(CACHE_PUTS));
assertNotNull(mreg.findMetric(GET_TIME));
assertArrayEquals(BOUNDS, mreg.<HistogramMetric>findMetric(GET_TIME).bounds());
if (nearEnabled) {
mreg = mmgr.registry(metricName(cachePrefix, "near"));
assertNotNull(mreg.findMetric(CACHE_GETS));
assertNotNull(mreg.findMetric(CACHE_PUTS));
assertNotNull(mreg.findMetric(GET_TIME));
assertArrayEquals(BOUNDS, mreg.<HistogramMetric>findMetric(GET_TIME).bounds());
}
}
}
use of org.apache.ignite.internal.processors.metric.MetricRegistry in project ignite by apache.
the class IoStatisticsCacheSelfTest method logicalReads.
/**
* @param mmgr Metric manager.
* @param type Staticstics type.
* @param id Metric registry id.
* @return Logical reads count.
*/
public static long logicalReads(GridMetricManager mmgr, IoStatisticsType type, String id) {
MetricRegistry mreg = mmgr.registry(metricName(type.metricGroupName(), id));
if (type == CACHE_GROUP)
return mreg.<LongMetric>findMetric(LOGICAL_READS).value();
else {
long leaf = mreg.<LongMetric>findMetric(LOGICAL_READS_LEAF).value();
long inner = mreg.<LongMetric>findMetric(LOGICAL_READS_INNER).value();
return leaf + inner;
}
}
Aggregations