use of org.apache.ignite.internal.processors.metric.MetricRegistry in project ignite by apache.
the class IoStatisticsMetricsLocalMXBeanImplSelfTest method testCacheBasic.
/**
* Simple test JMX bean for caches IO stats.
*
* @throws Exception In case of failure.
*/
@Test
public void testCacheBasic() throws Exception {
int cnt = 100;
populateCache(cnt);
clearCache(cnt);
resetMetric(ignite, metricName(CACHE_GROUP.metricGroupName(), DEFAULT_CACHE_NAME));
populateCache(cnt);
MetricRegistry mreg = ignite.context().metric().registry(metricName(CACHE_GROUP.metricGroupName(), DEFAULT_CACHE_NAME));
long cacheLogicalReadsCnt = mreg.<LongMetric>findMetric(LOGICAL_READS).value();
// 1 is for reuse bucket stripe.
assertEquals(cnt - 1, cacheLogicalReadsCnt);
long cachePhysicalReadsCnt = mreg.<LongMetric>findMetric(PHYSICAL_READS).value();
assertEquals(0, cachePhysicalReadsCnt);
}
use of org.apache.ignite.internal.processors.metric.MetricRegistry in project ignite by apache.
the class IoStatisticsMetricsLocalMXBeanImplSelfTest method testIndexBasic.
/**
* Simple test JMX bean for indexes IO stats.
*
* @throws Exception In case of failure.
*/
@Test
public void testIndexBasic() throws Exception {
resetMetric(ignite, metricName(HASH_INDEX.metricGroupName(), DEFAULT_CACHE_NAME, HASH_PK_IDX_NAME));
int cnt = 100;
populateCache(cnt);
MetricRegistry mreg = ignite.context().metric().registry(metricName(HASH_INDEX.metricGroupName(), DEFAULT_CACHE_NAME, HASH_PK_IDX_NAME));
long idxLeafLogicalCnt = mreg.<LongMetric>findMetric(LOGICAL_READS_LEAF).value();
assertEquals(cnt, idxLeafLogicalCnt);
long idxLeafPhysicalCnt = mreg.<LongMetric>findMetric(PHYSICAL_READS_LEAF).value();
assertEquals(0, idxLeafPhysicalCnt);
long idxInnerLogicalCnt = mreg.<LongMetric>findMetric(LOGICAL_READS_INNER).value();
assertEquals(0, idxInnerLogicalCnt);
long idxInnerPhysicalCnt = mreg.<LongMetric>findMetric(PHYSICAL_READS_INNER).value();
assertEquals(0, idxInnerPhysicalCnt);
}
use of org.apache.ignite.internal.processors.metric.MetricRegistry 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 org.apache.ignite.internal.processors.metric.MetricRegistry 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"));
}
use of org.apache.ignite.internal.processors.metric.MetricRegistry in project ignite by apache.
the class GridCacheAbstractMetricsSelfTest method metric.
/**
* @param name Metric name to find.
* @return Metric.
*/
protected <M extends Metric> M metric(String name) {
IgniteEx grid = grid(0);
boolean isNear = ((IgniteKernal) grid).internalCache(DEFAULT_CACHE_NAME).isNear();
MetricRegistry mreg = grid.context().metric().registry(cacheMetricsRegistryName(DEFAULT_CACHE_NAME, isNear));
M m = mreg.findMetric(name);
assertNotNull(m);
return m;
}
Aggregations