Search in sources :

Example 1 with GridMetricManager

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());
        }
    }
}
Also used : MetricRegistry(org.apache.ignite.internal.processors.metric.MetricRegistry) HistogramMetric(org.apache.ignite.spi.metric.HistogramMetric) GridMetricManager(org.apache.ignite.internal.processors.metric.GridMetricManager)

Example 2 with GridMetricManager

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);
}
Also used : IgniteEx(org.apache.ignite.internal.IgniteEx) GridMetricManager(org.apache.ignite.internal.processors.metric.GridMetricManager) GridCommonAbstractTest(org.apache.ignite.testframework.junits.common.GridCommonAbstractTest) Test(org.junit.Test)

Example 3 with GridMetricManager

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());
}
Also used : IgniteEx(org.apache.ignite.internal.IgniteEx) GridMetricManager(org.apache.ignite.internal.processors.metric.GridMetricManager)

Example 4 with GridMetricManager

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);
}
Also used : GridMetricManager(org.apache.ignite.internal.processors.metric.GridMetricManager)

Example 5 with GridMetricManager

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);
}
Also used : IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) GridKernalContext(org.apache.ignite.internal.GridKernalContext) NoopMetricExporterSpi(org.apache.ignite.spi.metric.noop.NoopMetricExporterSpi) GridMetricManager(org.apache.ignite.internal.processors.metric.GridMetricManager) IgniteLogger(org.apache.ignite.IgniteLogger) Test(org.junit.Test)

Aggregations

GridMetricManager (org.apache.ignite.internal.processors.metric.GridMetricManager)24 IgniteConfiguration (org.apache.ignite.configuration.IgniteConfiguration)10 PerformanceStatisticsProcessor (org.apache.ignite.internal.processors.performancestatistics.PerformanceStatisticsProcessor)9 NoopMetricExporterSpi (org.apache.ignite.spi.metric.noop.NoopMetricExporterSpi)9 Test (org.junit.Test)9 DataRegionConfiguration (org.apache.ignite.configuration.DataRegionConfiguration)8 DataRegionMetricsImpl (org.apache.ignite.internal.processors.cache.persistence.DataRegionMetricsImpl)8 GridEncryptionManager (org.apache.ignite.internal.managers.encryption.GridEncryptionManager)7 GridInternalSubscriptionProcessor (org.apache.ignite.internal.processors.subscription.GridInternalSubscriptionProcessor)7 DataStorageConfiguration (org.apache.ignite.configuration.DataStorageConfiguration)6 GridTestKernalContext (org.apache.ignite.testframework.junits.GridTestKernalContext)6 GridCommonAbstractTest (org.apache.ignite.testframework.junits.common.GridCommonAbstractTest)6 IgniteEx (org.apache.ignite.internal.IgniteEx)5 GridSystemViewManager (org.apache.ignite.internal.managers.systemview.GridSystemViewManager)5 JmxSystemViewExporterSpi (org.apache.ignite.internal.managers.systemview.JmxSystemViewExporterSpi)5 DirectMemoryProvider (org.apache.ignite.internal.mem.DirectMemoryProvider)5 FullPageId (org.apache.ignite.internal.pagemem.FullPageId)5 GridCacheSharedContext (org.apache.ignite.internal.processors.cache.GridCacheSharedContext)5 IgniteCacheDatabaseSharedManager (org.apache.ignite.internal.processors.cache.persistence.IgniteCacheDatabaseSharedManager)5 CheckpointProgress (org.apache.ignite.internal.processors.cache.persistence.checkpoint.CheckpointProgress)5