use of com.hazelcast.internal.metrics.LongGauge in project hazelcast by hazelcast.
the class RegisterAnnotatedMethodsTest method register_atomicInteger.
@Test
public void register_atomicInteger() {
AtomicIntegerMethod object = new AtomicIntegerMethod();
metricsRegistry.scanAndRegister(object, "foo");
LongGauge gauge = metricsRegistry.newLongGauge("foo.method");
assertEquals(object.method().get(), gauge.read());
}
use of com.hazelcast.internal.metrics.LongGauge in project hazelcast by hazelcast.
the class RegisterAnnotatedMethodsTest method register_staticMethod.
@Test
public void register_staticMethod() {
StaticMethod object = new StaticMethod();
metricsRegistry.scanAndRegister(object, "foo");
LongGauge gauge = metricsRegistry.newLongGauge("foo.method");
assertEquals(StaticMethod.method(), gauge.read());
}
use of com.hazelcast.internal.metrics.LongGauge in project hazelcast by hazelcast.
the class RegisterMetricTest method deregister_whenRegistered.
@Test
public void deregister_whenRegistered() {
MultiFieldAndMethod multiFieldAndMethod = new MultiFieldAndMethod();
multiFieldAndMethod.field1 = 1;
multiFieldAndMethod.field2 = 2;
metricsRegistry.scanAndRegister(multiFieldAndMethod, "foo");
LongGauge field1 = metricsRegistry.newLongGauge("foo.field1");
LongGauge field2 = metricsRegistry.newLongGauge("foo.field2");
LongGauge method1 = metricsRegistry.newLongGauge("foo.method1");
LongGauge method2 = metricsRegistry.newLongGauge("foo.method2");
metricsRegistry.deregister(multiFieldAndMethod);
// make sure that the the metrics have been removed
Set<String> names = metricsRegistry.getNames();
assertFalse(names.contains("foo.field1"));
assertFalse(names.contains("foo.field2"));
assertFalse(names.contains("foo.method1"));
assertFalse(names.contains("foo.method2"));
// make sure that the metric input has been disconnected
assertEquals(0, field1.read());
assertEquals(0, field2.read());
assertEquals(0, method1.read());
assertEquals(0, method2.read());
}
use of com.hazelcast.internal.metrics.LongGauge in project hazelcast by hazelcast.
the class LongGaugeImplTest method whenNoProbeSet.
// ============ getLong ===========================
@Test
public void whenNoProbeSet() {
LongGauge gauge = metricsRegistry.newLongGauge("foo");
long actual = gauge.read();
assertEquals(0, actual);
}
use of com.hazelcast.internal.metrics.LongGauge in project hazelcast by hazelcast.
the class LongGaugeImplTest method whenDoubleProbeField.
@Test
public void whenDoubleProbeField() {
SomeObject someObject = new SomeObject();
metricsRegistry.scanAndRegister(someObject, "foo");
LongGauge gauge = metricsRegistry.newLongGauge("foo.doubleField");
assertEquals(round(someObject.doubleField), gauge.read());
}
Aggregations