Search in sources :

Example 51 with Gauge

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

the class BufferPoolMetricSetTest method includesAGaugeForDirectCount.

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

Example 52 with Gauge

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

the class BufferPoolMetricSetTest method includesAGaugeForDirectCapacity.

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

Example 53 with Gauge

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

the class BufferPoolMetricSetTest method includesAGaugeForMappedMemoryUsed.

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

Example 54 with Gauge

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

the class MemoryUsageGaugeSetTest method hasAGaugeForHeapUsage.

@Test
public void hasAGaugeForHeapUsage() {
    final Gauge gauge = (Gauge) gauges.getMetrics().get("heap.usage");
    assertThat(gauge.getValue()).isEqualTo(0.75);
}
Also used : Gauge(com.codahale.metrics.Gauge) Test(org.junit.Test)

Example 55 with Gauge

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

the class MemoryUsageGaugeSetTest method hasAGaugeForTotalMax.

@Test
public void hasAGaugeForTotalMax() {
    final Gauge gauge = (Gauge) gauges.getMetrics().get("total.max");
    assertThat(gauge.getValue()).isEqualTo(44L);
}
Also used : Gauge(com.codahale.metrics.Gauge) Test(org.junit.Test)

Aggregations

Gauge (com.codahale.metrics.Gauge)64 Test (org.junit.Test)43 Counter (com.codahale.metrics.Counter)10 MetricRegistry (com.codahale.metrics.MetricRegistry)9 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 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 ValueList (org.collectd.api.ValueList)2 Assertion (org.opensaml.saml.saml2.core.Assertion)2