Search in sources :

Example 6 with MANDATORY

use of com.hazelcast.internal.metrics.ProbeLevel.MANDATORY in project hazelcast by hazelcast.

the class LongGaugeImplTest method whenReregister.

@Test
public void whenReregister() {
    metricsRegistry.registerStaticProbe(this, "foo", MANDATORY, (LongProbeFunction) o -> 10);
    LongGauge gauge = metricsRegistry.newLongGauge("foo");
    gauge.read();
    metricsRegistry.registerStaticProbe(this, "foo", MANDATORY, (LongProbeFunction) o -> 11);
    assertEquals(11, gauge.read());
}
Also used : QuickTest(com.hazelcast.test.annotation.QuickTest) MANDATORY(com.hazelcast.internal.metrics.ProbeLevel.MANDATORY) RunWith(org.junit.runner.RunWith) HazelcastSerialClassRunner(com.hazelcast.test.HazelcastSerialClassRunner) MetricDescriptor(com.hazelcast.internal.metrics.MetricDescriptor) Math.round(java.lang.Math.round) DoubleProbeFunction(com.hazelcast.internal.metrics.DoubleProbeFunction) LongGauge(com.hazelcast.internal.metrics.LongGauge) DynamicMetricsProvider(com.hazelcast.internal.metrics.DynamicMetricsProvider) WeakReference(java.lang.ref.WeakReference) LongProbeFunction(com.hazelcast.internal.metrics.LongProbeFunction) Before(org.junit.Before) INFO(com.hazelcast.internal.metrics.ProbeLevel.INFO) Logger(com.hazelcast.logging.Logger) COUNT(com.hazelcast.internal.metrics.ProbeUnit.COUNT) Probe(com.hazelcast.internal.metrics.Probe) HazelcastTestSupport(com.hazelcast.test.HazelcastTestSupport) MetricsCollectionContext(com.hazelcast.internal.metrics.MetricsCollectionContext) MetricsCollector(com.hazelcast.internal.metrics.collectors.MetricsCollector) Test(org.junit.Test) Category(org.junit.experimental.categories.Category) Assert.assertNull(org.junit.Assert.assertNull) BYTES(com.hazelcast.internal.metrics.ProbeUnit.BYTES) Assert.assertEquals(org.junit.Assert.assertEquals) Mockito.mock(org.mockito.Mockito.mock) LongGauge(com.hazelcast.internal.metrics.LongGauge) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 7 with MANDATORY

use of com.hazelcast.internal.metrics.ProbeLevel.MANDATORY in project hazelcast by hazelcast.

the class DoubleGaugeImplTest method whenLongProbe.

@Test
public void whenLongProbe() {
    metricsRegistry.registerStaticProbe(this, "foo", MANDATORY, (LongProbeFunction) o -> 10);
    DoubleGauge gauge = metricsRegistry.newDoubleGauge("foo");
    double actual = gauge.read();
    assertEquals(10, actual, 0.1);
}
Also used : INFO(com.hazelcast.internal.metrics.ProbeLevel.INFO) Logger(com.hazelcast.logging.Logger) COUNT(com.hazelcast.internal.metrics.ProbeUnit.COUNT) QuickTest(com.hazelcast.test.annotation.QuickTest) Probe(com.hazelcast.internal.metrics.Probe) HazelcastTestSupport(com.hazelcast.test.HazelcastTestSupport) MANDATORY(com.hazelcast.internal.metrics.ProbeLevel.MANDATORY) RunWith(org.junit.runner.RunWith) MetricsCollectionContext(com.hazelcast.internal.metrics.MetricsCollectionContext) MetricsCollector(com.hazelcast.internal.metrics.collectors.MetricsCollector) Test(org.junit.Test) DoubleGauge(com.hazelcast.internal.metrics.DoubleGauge) Category(org.junit.experimental.categories.Category) HazelcastSerialClassRunner(com.hazelcast.test.HazelcastSerialClassRunner) MetricDescriptor(com.hazelcast.internal.metrics.MetricDescriptor) Assert.assertNull(org.junit.Assert.assertNull) BYTES(com.hazelcast.internal.metrics.ProbeUnit.BYTES) DoubleProbeFunction(com.hazelcast.internal.metrics.DoubleProbeFunction) DynamicMetricsProvider(com.hazelcast.internal.metrics.DynamicMetricsProvider) WeakReference(java.lang.ref.WeakReference) Assert.assertEquals(org.junit.Assert.assertEquals) LongProbeFunction(com.hazelcast.internal.metrics.LongProbeFunction) Before(org.junit.Before) Mockito.mock(org.mockito.Mockito.mock) DoubleGauge(com.hazelcast.internal.metrics.DoubleGauge) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Aggregations

DoubleProbeFunction (com.hazelcast.internal.metrics.DoubleProbeFunction)7 DynamicMetricsProvider (com.hazelcast.internal.metrics.DynamicMetricsProvider)7 LongProbeFunction (com.hazelcast.internal.metrics.LongProbeFunction)7 MetricDescriptor (com.hazelcast.internal.metrics.MetricDescriptor)7 MetricsCollectionContext (com.hazelcast.internal.metrics.MetricsCollectionContext)7 Probe (com.hazelcast.internal.metrics.Probe)7 INFO (com.hazelcast.internal.metrics.ProbeLevel.INFO)7 MANDATORY (com.hazelcast.internal.metrics.ProbeLevel.MANDATORY)7 BYTES (com.hazelcast.internal.metrics.ProbeUnit.BYTES)7 COUNT (com.hazelcast.internal.metrics.ProbeUnit.COUNT)7 MetricsCollector (com.hazelcast.internal.metrics.collectors.MetricsCollector)7 Logger (com.hazelcast.logging.Logger)7 HazelcastSerialClassRunner (com.hazelcast.test.HazelcastSerialClassRunner)7 HazelcastTestSupport (com.hazelcast.test.HazelcastTestSupport)7 QuickTest (com.hazelcast.test.annotation.QuickTest)7 WeakReference (java.lang.ref.WeakReference)7 Assert.assertEquals (org.junit.Assert.assertEquals)7 Assert.assertNull (org.junit.Assert.assertNull)7 Before (org.junit.Before)7 Test (org.junit.Test)7