Search in sources :

Example 56 with MetricRegistry

use of org.apache.ignite.internal.processors.metric.MetricRegistry in project ignite by apache.

the class MetricCommandTest method testDoubleMetrics.

/**
 */
@Test
public void testDoubleMetrics() {
    String mregName = "int-double-registry";
    MetricRegistry mreg = ignite0.context().metric().registry(mregName);
    mreg.doubleMetric("double-metric", "").add(111.222);
    assertEquals("111.222", metric(ignite0, metricName(mregName, "double-metric")));
    mreg.register("double-gauge", () -> 0D, "");
    assertEquals("0.0", metric(ignite0, metricName(mregName, "double-gauge")));
}
Also used : MetricRegistry(org.apache.ignite.internal.processors.metric.MetricRegistry) Test(org.junit.Test)

Example 57 with MetricRegistry

use of org.apache.ignite.internal.processors.metric.MetricRegistry in project ignite by apache.

the class DataRegionMetricsImpl method pageMemory.

/**
 * @param pageMem Page mem.
 */
public void pageMemory(PageMemory pageMem) {
    this.pageMem = pageMem;
    MetricRegistry mreg = metricRegistry();
    mreg.register("PagesFillFactor", this::getPagesFillFactor, "The percentage of the used space.");
    mreg.register("PhysicalMemoryPages", this::getPhysicalMemoryPages, "Number of pages residing in physical RAM.");
    mreg.register("OffheapUsedSize", this::getOffheapUsedSize, "Offheap used size in bytes.");
    mreg.register("TotalAllocatedSize", this::getTotalAllocatedSize, "Gets a total size of memory allocated in the data region, in bytes");
    mreg.register("PhysicalMemorySize", this::getPhysicalMemorySize, "Gets total size of pages loaded to the RAM, in bytes");
    mreg.register("UsedCheckpointBufferSize", this::getUsedCheckpointBufferSize, "Gets used checkpoint buffer size in bytes");
}
Also used : MetricRegistry(org.apache.ignite.internal.processors.metric.MetricRegistry)

Example 58 with MetricRegistry

use of org.apache.ignite.internal.processors.metric.MetricRegistry in project ignite by apache.

the class DataRegionMetricsImpl method createCacheGrpPageMetrics.

/**
 * Creates memory page metrics container associated with the given cache group.
 */
private PageMetrics createCacheGrpPageMetrics(String cacheGrpName) {
    String registryName = MetricUtils.cacheGroupMetricsRegistryName(cacheGrpName);
    MetricRegistry registry = kernalCtx.metric().registry(registryName);
    return PageMetricsImpl.builder(registry).totalPagesCallback(delegate(dataRegionPageMetrics.totalPages())).indexPagesCallback(delegate(dataRegionPageMetrics.indexPages())).build();
}
Also used : MetricRegistry(org.apache.ignite.internal.processors.metric.MetricRegistry)

Example 59 with MetricRegistry

use of org.apache.ignite.internal.processors.metric.MetricRegistry in project ignite by apache.

the class GridMetricsJolBenchmark method measureMetricRegistry.

/**
 * Calculates and prints the size of metric registry of {@code TOTAL} size;
 */
private static void measureMetricRegistry() {
    MetricRegistry mreg = new MetricRegistry("test", name -> null, name -> null, null);
    for (int i = 0; i < BOOLEAN_CNT; i++) mreg.booleanMetric(BOOLEAN_METRIC + i, null);
    for (int i = 0; i < DOUBLE_CNT; i++) mreg.doubleMetric(DOUBLE_METRIC + i, null);
    for (int i = 0; i < INT_CNT; i++) mreg.doubleMetric(INT_METRIC + i, null);
    for (int i = 0; i < LONG_CNT; i++) mreg.longMetric(LONG_METRIC + i, null);
    for (int i = 0; i < LONG_ADDER_CNT; i++) mreg.longMetric(LONG_ADDER_METRIC + i, null);
    long sz = GraphLayout.parseInstance(mreg).totalSize();
    System.out.println("Total size of " + TOTAL + " metric registry is " + (sz / 1024) + "KiB, " + sz + " bytes.");
}
Also used : MetricRegistry(org.apache.ignite.internal.processors.metric.MetricRegistry)

Example 60 with MetricRegistry

use of org.apache.ignite.internal.processors.metric.MetricRegistry in project ignite by apache.

the class ClusterProcessor method registerMetrics.

/**
 *  Registers cluster metrics.
 */
public void registerMetrics() {
    MetricRegistry reg = ctx.metric().registry(CLUSTER_METRICS);
    reg.register(TOTAL_SERVER_NODES, () -> ctx.isStopping() || ctx.clientDisconnected() ? -1 : cluster.forServers().nodes().size(), "Server nodes count.");
    reg.register(TOTAL_CLIENT_NODES, () -> ctx.isStopping() || ctx.clientDisconnected() ? -1 : cluster.forClients().nodes().size(), "Client nodes count.");
    reg.register(TOTAL_BASELINE_NODES, () -> ctx.isStopping() || ctx.clientDisconnected() ? -1 : F.size(cluster.currentBaselineTopology()), "Total baseline nodes count.");
    reg.register(ACTIVE_BASELINE_NODES, () -> {
        if (ctx.isStopping() || ctx.clientDisconnected())
            return -1;
        Collection<Object> srvIds = F.nodeConsistentIds(cluster.forServers().nodes());
        return F.size(cluster.currentBaselineTopology(), node -> srvIds.contains(node.consistentId()));
    }, "Active baseline nodes count.");
}
Also used : MetricRegistry(org.apache.ignite.internal.processors.metric.MetricRegistry) GridTimeoutObject(org.apache.ignite.internal.processors.timeout.GridTimeoutObject)

Aggregations

MetricRegistry (org.apache.ignite.internal.processors.metric.MetricRegistry)86 Test (org.junit.Test)52 GridCommonAbstractTest (org.apache.ignite.testframework.junits.common.GridCommonAbstractTest)29 IgniteEx (org.apache.ignite.internal.IgniteEx)26 LongMetric (org.apache.ignite.spi.metric.LongMetric)26 List (java.util.List)11 CountDownLatch (java.util.concurrent.CountDownLatch)11 UUID (java.util.UUID)10 Map (java.util.Map)8 CacheConfiguration (org.apache.ignite.configuration.CacheConfiguration)8 IgniteConfiguration (org.apache.ignite.configuration.IgniteConfiguration)8 ArrayList (java.util.ArrayList)7 IgniteException (org.apache.ignite.IgniteException)7 IgniteInternalFuture (org.apache.ignite.internal.IgniteInternalFuture)7 IntMetric (org.apache.ignite.spi.metric.IntMetric)7 IgniteCache (org.apache.ignite.IgniteCache)6 ClusterNode (org.apache.ignite.cluster.ClusterNode)6 Arrays (java.util.Arrays)5 HashSet (java.util.HashSet)5 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)5