use of org.apache.ignite.internal.processors.metric.MetricRegistry in project ignite by apache.
the class MetricCommandTest method testRegistryMetrics.
/**
*/
@Test
public void testRegistryMetrics() {
String mregName = "test-metric-registry";
MetricRegistry mreg = ignite0.context().metric().registry(mregName);
mreg.booleanMetric("boolean-metric", "");
mreg.longMetric("long-metric", "").increment();
mreg.intMetric("int-metric", "").increment();
mreg.doubleMetric("double-metric", "");
mreg.hitRateMetric("hitrate-metric", "", getTestTimeout(), 2);
mreg.histogram("histogram", new long[] { 50, 100 }, null).value(10);
mreg.hitRateMetric("hitrate-metric", "", getTestTimeout(), 2);
mreg.objectMetric("object-metric", Object.class, "").value(new Object() {
@Override
public String toString() {
return "test-object";
}
});
Map<String, String> metrics = metrics(ignite0, mregName);
assertEquals("0.0", metrics.get(metricName(mregName, "double-metric")));
assertEquals("false", metrics.get(metricName(mregName, "boolean-metric")));
assertEquals("1", metrics.get(metricName(mregName, "long-metric")));
assertEquals("1", metrics.get(metricName(mregName, "int-metric")));
assertEquals("test-object", metrics.get(metricName(mregName, "object-metric")));
assertEquals("[1, 0, 0]", metrics.get(metricName(mregName, "histogram")));
assertEquals("0", metric(ignite0, metricName(mregName, "hitrate-metric")));
}
use of org.apache.ignite.internal.processors.metric.MetricRegistry in project ignite by apache.
the class MetricCommandTest method testHistogramMetrics.
/**
*/
@Test
public void testHistogramMetrics() {
String mregName = "histogram-registry";
MetricRegistry mreg = ignite0.context().metric().registry(mregName);
long[] bounds = new long[] { 50, 500 };
HistogramMetricImpl histogram = mreg.histogram("histogram", bounds, null);
histogram.value(10);
histogram.value(51);
histogram.value(60);
histogram.value(600);
histogram.value(600);
histogram.value(600);
histogram = mreg.histogram("histogram_with_underscore", bounds, null);
histogram.value(10);
histogram.value(51);
histogram.value(60);
histogram.value(600);
histogram.value(600);
histogram.value(600);
assertEquals("1", metric(ignite0, metricName(mregName, "histogram_0_50")));
assertEquals("2", metric(ignite0, metricName(mregName, "histogram_50_500")));
assertEquals("3", metric(ignite0, metricName(mregName, "histogram_500_inf")));
assertEquals("[1, 2, 3]", metric(ignite0, metricName(mregName, "histogram")));
assertEquals("1", metric(ignite0, metricName(mregName, "histogram_with_underscore_0_50")));
assertEquals("2", metric(ignite0, metricName(mregName, "histogram_with_underscore_50_500")));
assertEquals("3", metric(ignite0, metricName(mregName, "histogram_with_underscore_500_inf")));
assertEquals("[1, 2, 3]", metric(ignite0, metricName(mregName, "histogram_with_underscore")));
}
use of org.apache.ignite.internal.processors.metric.MetricRegistry in project ignite by apache.
the class MetricCommandTest method testNodeIdArgument.
/**
*/
@Test
public void testNodeIdArgument() {
String mregName = "boolean-metric-registry";
MetricRegistry mreg = ignite0.context().metric().registry(mregName);
mreg.booleanMetric("boolean-metric", "");
mreg = ignite(1).context().metric().registry(mregName);
mreg.booleanMetric("boolean-metric", "").value(true);
assertEquals("false", metric(ignite0, metricName(mregName, "boolean-metric")));
assertEquals("true", metric(ignite(1), metricName(mregName, "boolean-metric")));
}
use of org.apache.ignite.internal.processors.metric.MetricRegistry in project ignite by apache.
the class MetricCommandTest method testHitrateMetrics.
/**
*/
@Test
public void testHitrateMetrics() {
String mregName = "hitrate-registry";
MetricRegistry mreg = ignite0.context().metric().registry(mregName);
mreg.hitRateMetric("hitrate-metric", "", getTestTimeout(), 2).add(Integer.MAX_VALUE);
assertEquals(Integer.toString(Integer.MAX_VALUE), metric(ignite0, metricName(mregName, "hitrate-metric")));
}
use of org.apache.ignite.internal.processors.metric.MetricRegistry in project ignite by apache.
the class GridCacheVersionManager method start0.
/**
* {@inheritDoc}
*/
@Override
public void start0() throws IgniteCheckedException {
MetricRegistry sysreg = cctx.kernalContext().metric().registry(CACHE_METRICS);
lastDataVer = sysreg.longMetric(LAST_DATA_VER, "The latest data version on the node.");
sysreg.register(DATA_VER_CLUSTER_ID, () -> dataCenterId, "Data version cluster id.");
startVer = new GridCacheVersion(0, 0, 0, dataCenterId);
cctx.gridEvents().addLocalEventListener(discoLsnr, EVT_NODE_METRICS_UPDATED);
}
Aggregations