use of javax.management.DynamicMBean in project ignite by apache.
the class JmxExporterSpiTest method testDataRegionJmxMetrics.
/**
*/
@Test
public void testDataRegionJmxMetrics() throws Exception {
DynamicMBean dataRegionMBean = metricRegistry(ignite.name(), "io", "dataregion.default");
Set<String> res = stream(dataRegionMBean.getMBeanInfo().getAttributes()).map(MBeanFeatureInfo::getName).collect(toSet());
assertTrue(res.containsAll(EXPECTED_ATTRIBUTES));
for (String metricName : res) assertNotNull(metricName, dataRegionMBean.getAttribute(metricName));
DataRegionConfiguration cfg = ignite.configuration().getDataStorageConfiguration().getDefaultDataRegionConfiguration();
assertEquals(cfg.getInitialSize(), dataRegionMBean.getAttribute("InitialSize"));
assertEquals(cfg.getMaxSize(), dataRegionMBean.getAttribute("MaxSize"));
}
use of javax.management.DynamicMBean in project ignite by apache.
the class JmxExporterSpiTest method testSysJmxMetrics.
/**
*/
@Test
public void testSysJmxMetrics() throws Exception {
DynamicMBean sysMBean = metricRegistry(ignite.name(), null, SYS_METRICS);
Set<String> res = stream(sysMBean.getMBeanInfo().getAttributes()).map(MBeanFeatureInfo::getName).collect(toSet());
assertTrue(res.contains(CPU_LOAD));
assertTrue(res.contains(GC_CPU_LOAD));
assertTrue(res.contains(metricName("memory", "heap", "init")));
assertTrue(res.contains(metricName("memory", "heap", "used")));
assertTrue(res.contains(metricName("memory", "nonheap", "committed")));
assertTrue(res.contains(metricName("memory", "nonheap", "max")));
Optional<MBeanAttributeInfo> cpuLoad = stream(sysMBean.getMBeanInfo().getAttributes()).filter(a -> a.getName().equals(CPU_LOAD)).findFirst();
assertTrue(cpuLoad.isPresent());
assertEquals(CPU_LOAD_DESCRIPTION, cpuLoad.get().getDescription());
Optional<MBeanAttributeInfo> gcCpuLoad = stream(sysMBean.getMBeanInfo().getAttributes()).filter(a -> a.getName().equals(GC_CPU_LOAD)).findFirst();
assertTrue(gcCpuLoad.isPresent());
assertEquals(GC_CPU_LOAD_DESCRIPTION, gcCpuLoad.get().getDescription());
}
use of javax.management.DynamicMBean in project ignite by apache.
the class JmxExporterSpiTest method systemView.
/**
*/
public TabularDataSupport systemView(IgniteEx g, String name) {
try {
DynamicMBean caches = metricRegistry(g.name(), VIEWS, name);
MBeanAttributeInfo[] attrs = caches.getMBeanInfo().getAttributes();
assertEquals(1, attrs.length);
return (TabularDataSupport) caches.getAttribute(VIEWS);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
use of javax.management.DynamicMBean in project ignite by apache.
the class JmxExporterSpiTest method testUnregisterRemovedRegistry.
/**
*/
@Test
public void testUnregisterRemovedRegistry() throws Exception {
String n = "cache-for-remove";
IgniteCache c = ignite.createCache(n);
DynamicMBean cacheBean = metricRegistry(ignite.name(), CACHE_METRICS, n);
assertNotNull(cacheBean);
ignite.destroyCache(n);
assertThrowsWithCause(() -> metricRegistry(ignite.name(), CACHE_METRICS, n), IgniteException.class);
}
use of javax.management.DynamicMBean in project ignite by apache.
the class JmxExporterSpiTest method testJmxHistogramNamesExport.
/**
*/
@Test
public void testJmxHistogramNamesExport() throws Exception {
MetricRegistry reg = ignite.context().metric().registry(REGISTRY_NAME);
String simpleName = "testhist";
String nameWithUnderscore = "test_hist";
reg.histogram(simpleName, new long[] { 10, 100 }, null);
reg.histogram(nameWithUnderscore, new long[] { 10, 100 }, null);
DynamicMBean mbn = metricRegistry(ignite.name(), null, REGISTRY_NAME);
assertNotNull(mbn.getAttribute(simpleName + '_' + 0 + '_' + 10));
assertEquals(0L, mbn.getAttribute(simpleName + '_' + 0 + '_' + 10));
assertNotNull(mbn.getAttribute(simpleName + '_' + 10 + '_' + 100));
assertEquals(0L, mbn.getAttribute(simpleName + '_' + 10 + '_' + 100));
assertNotNull(mbn.getAttribute(nameWithUnderscore + '_' + 10 + '_' + 100));
assertEquals(0L, mbn.getAttribute(nameWithUnderscore + '_' + 10 + '_' + 100));
assertNotNull(mbn.getAttribute(simpleName + '_' + 100 + "_inf"));
assertEquals(0L, mbn.getAttribute(simpleName + '_' + 100 + "_inf"));
}
Aggregations