Search in sources :

Example 31 with LongGauge

use of com.hazelcast.internal.metrics.LongGauge in project hazelcast by hazelcast.

the class RegisterAnnotatedFieldsTest method register_customName.

@Test
public void register_customName() {
    ObjectLongGaugeFieldWithName object = new ObjectLongGaugeFieldWithName();
    metricsRegistry.scanAndRegister(object, "foo");
    LongGauge gauge = metricsRegistry.newLongGauge("foo.myfield");
    object.field = 10;
    assertEquals(object.field, gauge.read());
}
Also used : LongGauge(com.hazelcast.internal.metrics.LongGauge) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 32 with LongGauge

use of com.hazelcast.internal.metrics.LongGauge in project hazelcast by hazelcast.

the class RegisterAnnotatedFieldsTest method register_primitiveInteger.

@Test
public void register_primitiveInteger() {
    PrimitiveIntegerField object = new PrimitiveIntegerField();
    metricsRegistry.scanAndRegister(object, "foo");
    LongGauge gauge = metricsRegistry.newLongGauge("foo.field");
    object.field = 10;
    assertEquals(object.field, gauge.read());
}
Also used : LongGauge(com.hazelcast.internal.metrics.LongGauge) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 33 with LongGauge

use of com.hazelcast.internal.metrics.LongGauge in project hazelcast by hazelcast.

the class OperatingSystemMetricSetTest method registerMethod_whenLong.

@Test
public void registerMethod_whenLong() {
    metricsRegistry = new MetricsRegistryImpl(Logger.getLogger(MetricsRegistryImpl.class), INFO);
    FakeOperatingSystemBean fakeOperatingSystemBean = new FakeOperatingSystemBean();
    registerMethod(metricsRegistry, fakeOperatingSystemBean, "longMethod", "longMethod");
    LongGauge gauge = metricsRegistry.newLongGauge("longMethod");
    assertEquals(fakeOperatingSystemBean.longMethod(), gauge.read());
}
Also used : LongGauge(com.hazelcast.internal.metrics.LongGauge) MetricsRegistryImpl(com.hazelcast.internal.metrics.impl.MetricsRegistryImpl) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 34 with LongGauge

use of com.hazelcast.internal.metrics.LongGauge in project hazelcast by hazelcast.

the class RuntimeMetricSetTest method freeMemory.

@Test
public void freeMemory() {
    final LongGauge gauge = metricsRegistry.newLongGauge("runtime.freeMemory");
    assertTrueEventually(new AssertTask() {

        @Override
        public void run() throws Exception {
            assertEquals(runtime.freeMemory(), gauge.read(), TEN_MB);
        }
    });
}
Also used : LongGauge(com.hazelcast.internal.metrics.LongGauge) AssertTask(com.hazelcast.test.AssertTask) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 35 with LongGauge

use of com.hazelcast.internal.metrics.LongGauge in project hazelcast by hazelcast.

the class RuntimeMetricSetTest method usedMemory.

@Test
public void usedMemory() {
    final LongGauge gauge = metricsRegistry.newLongGauge("runtime.usedMemory");
    assertTrueEventually(new AssertTask() {

        @Override
        public void run() throws Exception {
            double expected = runtime.totalMemory() - runtime.freeMemory();
            assertEquals(expected, gauge.read(), TEN_MB);
        }
    });
}
Also used : LongGauge(com.hazelcast.internal.metrics.LongGauge) AssertTask(com.hazelcast.test.AssertTask) 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