use of org.apache.ignite.internal.processors.metric.GridMetricManager in project ignite by apache.
the class IoStatisticsCacheSelfTest method testCacheGroupCaches.
/**
* Test statistics for two caches in the same cache group.
*/
@Test
public void testCacheGroupCaches() throws Exception {
prepareData(RECORD_COUNT, CACHE1_IN_GROUP_NAME, CACHE2_IN_GROUP_NAME);
GridMetricManager mmgr = ignite.context().metric();
Set<String> statisticCacheNames = deriveStatisticNames(CACHE_GROUP);
assertEquals(ALL_CACHE_GROUP_NAMES, statisticCacheNames);
long logicalReads = logicalReads(mmgr, CACHE_GROUP, CACHE_GROUP_NAME);
assertEquals(RECORD_COUNT * 4, logicalReads);
}
use of org.apache.ignite.internal.processors.metric.GridMetricManager in project ignite by apache.
the class IoStatisticsCacheSelfTest method testForThreeCaches.
/**
* Test statistics for three caches in the same time.
*/
@Test
public void testForThreeCaches() throws Exception {
prepareData(RECORD_COUNT, ATOMIC_CACHE_NAME, TRANSACTIONAL_CACHE_NAME, MVCC_CACHE_NAME);
GridMetricManager mmgr = ignite.context().metric();
Set<String> statisticCacheNames = deriveStatisticNames(CACHE_GROUP);
assertEquals(ALL_CACHE_GROUP_NAMES, statisticCacheNames);
Stream.of(ATOMIC_CACHE_NAME, TRANSACTIONAL_CACHE_NAME, MVCC_CACHE_NAME).forEach((cacheName) -> {
long logicalReads = logicalReads(mmgr, CACHE_GROUP, cacheName);
assertTrue(logicalReads > RECORD_COUNT);
});
}
use of org.apache.ignite.internal.processors.metric.GridMetricManager in project ignite by apache.
the class IoStatisticsCacheSelfTest method cacheTest.
/**
* @param cacheName Name of cache.
* @param rowCnt Number of row need to put into cache.
* @param dataPageReads How many data page reads operation expected.
* @param idxPageReadsCnt How many index page reads scan expected.
*/
protected void cacheTest(String cacheName, int rowCnt, int dataPageReads, int idxPageReadsCnt) throws Exception {
prepareData(rowCnt, cacheName);
GridMetricManager mmgr = ignite.context().metric();
Set<String> statisticCacheNames = deriveStatisticNames(CACHE_GROUP);
assertEquals(ALL_CACHE_GROUP_NAMES, statisticCacheNames);
assertTrue(statisticCacheNames.contains(cacheName));
long logicalReadsCache = logicalReads(mmgr, CACHE_GROUP, cacheName);
assertEquals(dataPageReads, logicalReadsCache);
long logicalReadsIdx = logicalReads(mmgr, HASH_INDEX, metricName(cacheName, HASH_PK_IDX_NAME));
assertEquals(idxPageReadsCnt, logicalReadsIdx);
}
use of org.apache.ignite.internal.processors.metric.GridMetricManager in project ignite by apache.
the class GridManagerStopSelfTest method testStopCommunicationManager.
/**
* @throws Exception If failed.
*/
@Test
public void testStopCommunicationManager() throws Exception {
CommunicationSpi spi = new TcpCommunicationSpi();
injectLogger(spi);
ctx.config().setCommunicationSpi(spi);
ctx.config().setMarshaller(new BinaryMarshaller());
ctx.config().setMetricExporterSpi(new NoopMetricExporterSpi());
ctx.add(new GridMetricManager(ctx));
GridIoManager mgr = new GridIoManager(ctx);
mgr.onKernalStop(true);
mgr.stop(false);
}
use of org.apache.ignite.internal.processors.metric.GridMetricManager in project ignite by apache.
the class CacheMetricsAddRemoveTest method checkMetricsEmpty.
/**
*/
private void checkMetricsEmpty(String cachePrefix) {
for (int i = 0; i < 3; i++) {
GridMetricManager mmgr = metricManager(i);
assertFalse(Iterators.tryFind(mmgr.iterator(), reg -> cachePrefix.equals(reg.name())).isPresent());
if (nearEnabled) {
String regName = metricName(cachePrefix, "near");
assertFalse(Iterators.tryFind(mmgr.iterator(), reg -> regName.equals(reg.name())).isPresent());
}
}
}
Aggregations