Search in sources :

Example 1 with Gauge

use of com.codahale.metrics.Gauge in project metrics by dropwizard.

the class BufferPoolMetricSetTest method includesAGaugeForDirectMemoryUsed.

@Test
public void includesAGaugeForDirectMemoryUsed() throws Exception {
    final Gauge gauge = (Gauge) buffers.getMetrics().get("direct.used");
    when(mBeanServer.getAttribute(direct, "MemoryUsed")).thenReturn(100);
    assertThat(gauge.getValue()).isEqualTo(100);
}
Also used : Gauge(com.codahale.metrics.Gauge) Test(org.junit.Test)

Example 2 with Gauge

use of com.codahale.metrics.Gauge in project metrics by dropwizard.

the class BufferPoolMetricSetTest method includesAGaugeForMappedCount.

@Test
public void includesAGaugeForMappedCount() throws Exception {
    final Gauge gauge = (Gauge) buffers.getMetrics().get("mapped.count");
    when(mBeanServer.getAttribute(mapped, "Count")).thenReturn(100);
    assertThat(gauge.getValue()).isEqualTo(100);
}
Also used : Gauge(com.codahale.metrics.Gauge) Test(org.junit.Test)

Example 3 with Gauge

use of com.codahale.metrics.Gauge in project metrics by dropwizard.

the class BufferPoolMetricSetTest method includesAGaugeForMappedCapacity.

@Test
public void includesAGaugeForMappedCapacity() throws Exception {
    final Gauge gauge = (Gauge) buffers.getMetrics().get("mapped.capacity");
    when(mBeanServer.getAttribute(mapped, "TotalCapacity")).thenReturn(100);
    assertThat(gauge.getValue()).isEqualTo(100);
}
Also used : Gauge(com.codahale.metrics.Gauge) Test(org.junit.Test)

Example 4 with Gauge

use of com.codahale.metrics.Gauge in project metrics by dropwizard.

the class ClassLoadingGaugeSetTest method loadedGauge.

@Test
public void loadedGauge() throws Exception {
    final Gauge gauge = (Gauge) gauges.getMetrics().get("loaded");
    assertThat(gauge.getValue()).isEqualTo(2L);
}
Also used : Gauge(com.codahale.metrics.Gauge) Test(org.junit.Test)

Example 5 with Gauge

use of com.codahale.metrics.Gauge in project metrics by dropwizard.

the class ClassLoadingGaugeSetTest method unLoadedGauge.

@Test
public void unLoadedGauge() throws Exception {
    final Gauge gauge = (Gauge) gauges.getMetrics().get("unloaded");
    assertThat(gauge.getValue()).isEqualTo(1L);
}
Also used : Gauge(com.codahale.metrics.Gauge) Test(org.junit.Test)

Aggregations

Gauge (com.codahale.metrics.Gauge)57 Test (org.junit.Test)38 Counter (com.codahale.metrics.Counter)10 Meter (com.codahale.metrics.Meter)8 Metric (com.codahale.metrics.Metric)8 Timer (com.codahale.metrics.Timer)7 SortedMap (java.util.SortedMap)7 Histogram (com.codahale.metrics.Histogram)6 MetricRegistry (com.codahale.metrics.MetricRegistry)6 Map (java.util.Map)6 Matchers.anyString (org.mockito.Matchers.anyString)3 Snapshot (com.codahale.metrics.Snapshot)2 Date (java.util.Date)2 HashMap (java.util.HashMap)2 TreeMap (java.util.TreeMap)2 Semaphore (java.util.concurrent.Semaphore)2 SolrMetricManager (org.apache.solr.metrics.SolrMetricManager)2 SolrQueryRequest (org.apache.solr.request.SolrQueryRequest)2 AsmGauge (com.alibaba.jstorm.common.metric.AsmGauge)1 MetricSet (com.codahale.metrics.MetricSet)1