Search in sources :

Example 21 with LongGauge

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());
}
Also used : LongGauge(com.hazelcast.internal.metrics.LongGauge) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 22 with LongGauge

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());
}
Also used : LongGauge(com.hazelcast.internal.metrics.LongGauge) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 23 with LongGauge

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());
}
Also used : LongGauge(com.hazelcast.internal.metrics.LongGauge) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Example 24 with LongGauge

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);
}
Also used : LongGauge(com.hazelcast.internal.metrics.LongGauge) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 25 with LongGauge

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());
}
Also used : LongGauge(com.hazelcast.internal.metrics.LongGauge) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Aggregations

LongGauge (com.hazelcast.internal.metrics.LongGauge)53 QuickTest (com.hazelcast.test.annotation.QuickTest)53 Test (org.junit.Test)53 AssertTask (com.hazelcast.test.AssertTask)18 LongProbeFunction (com.hazelcast.internal.metrics.LongProbeFunction)3 File (java.io.File)3 MetricsRegistryImpl (com.hazelcast.internal.metrics.impl.MetricsRegistryImpl)1 ParallelTest (com.hazelcast.test.annotation.ParallelTest)1