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")));
}
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");
}
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();
}
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.");
}
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.");
}
Aggregations