use of org.apache.ignite.internal.processors.metric.GridMetricManager 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.GridMetricManager in project ignite by apache.
the class IoStatisticsSelfTest method testEmptyIOStat.
/**
* Test existing zero statistics for not touched caches.
*
* @throws Exception In case of failure.
*/
@Test
public void testEmptyIOStat() throws Exception {
IgniteEx ign = prepareIgnite(true);
GridMetricManager mmgr = ign.context().metric();
checkEmptyStat(mmgr.registry(metricName(CACHE_GROUP.metricGroupName(), DEFAULT_CACHE_NAME)), CACHE_GROUP);
checkEmptyStat(mmgr.registry(metricName(HASH_INDEX.metricGroupName(), DEFAULT_CACHE_NAME, HASH_PK_IDX_NAME)), HASH_INDEX);
}
use of org.apache.ignite.internal.processors.metric.GridMetricManager in project ignite by apache.
the class IoStatisticsSelfTest method ioStatGlobalPageTrackTest.
/**
* Check LOCAL_NODE statistics tracking.
*
* @param isPersistent {@code true} in case persistence should be enable.
* @throws Exception In case of failure.
*/
private void ioStatGlobalPageTrackTest(boolean isPersistent) throws Exception {
IgniteEx grid = prepareData(isPersistent);
GridMetricManager mmgr = grid.context().metric();
long physicalReadsCnt = physicalReads(mmgr, CACHE_GROUP, DEFAULT_CACHE_NAME, null);
if (isPersistent)
Assert.assertTrue(physicalReadsCnt > 0);
else
Assert.assertEquals(0, physicalReadsCnt);
Long logicalReads = logicalReads(mmgr, HASH_INDEX, metricName(DEFAULT_CACHE_NAME, HASH_PK_IDX_NAME));
Assert.assertNotNull(logicalReads);
Assert.assertEquals(RECORD_COUNT, logicalReads.longValue());
}
use of org.apache.ignite.internal.processors.metric.GridMetricManager in project ignite by apache.
the class AbstractExporterSpiTest method createAdditionalMetrics.
/**
* Creates some additional metrics.
*
* @param ignite Ignite.
*/
protected void createAdditionalMetrics(IgniteEx ignite) {
GridMetricManager mmgr = ignite.context().metric();
mmgr.registry(FILTERED_PREFIX).longMetric("test", "").add(2);
mmgr.registry("other.prefix").longMetric("test", "").add(42);
mmgr.registry("other.prefix").longMetric("test2", "").add(43);
mmgr.registry("other.prefix2").longMetric("test3", "").add(44);
}
use of org.apache.ignite.internal.processors.metric.GridMetricManager in project ignite by apache.
the class GridManagerMxBeanIllegalArgumentHandleTest method testIllegalStateIsCatch.
/**
* Creates minimal disco manager mock, checks illegal state is not propagated
*/
@Test
public void testIllegalStateIsCatch() {
final IgniteConfiguration cfg = new IgniteConfiguration();
cfg.setMetricExporterSpi(new NoopMetricExporterSpi());
final IgniteLogger log = Mockito.mock(IgniteLogger.class);
final GridKernalContext ctx = Mockito.mock(GridKernalContext.class);
when(ctx.config()).thenReturn(cfg);
when(ctx.log(Mockito.anyString())).thenReturn(log);
when(ctx.log(Mockito.any(Class.class))).thenReturn(log);
final GridMetricManager mgr = new GridMetricManager(ctx);
final long nHeapMax = mgr.nonHeapMemoryUsage().getMax();
if (correctSetupOfTestPerformed)
assertEquals(0, nHeapMax);
final long heapMax = mgr.heapMemoryUsage().getMax();
if (correctSetupOfTestPerformed)
assertEquals(0, heapMax);
}
Aggregations