Search in sources :

Example 16 with Gauge

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

the class MemoryUsageGaugeSetTest method hasAGaugeForWeirdMemoryPoolMax.

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

Example 17 with Gauge

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

the class MemoryUsageGaugeSetTest method hasAGaugeForHeapUsed.

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

Example 18 with Gauge

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

the class MemoryUsageGaugeSetTest method hasAGaugeForTotalUsed.

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

Example 19 with Gauge

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

the class MemoryUsageGaugeSetTest method hasAGaugeForWeirdMemoryPoolUsage.

@Test
public void hasAGaugeForWeirdMemoryPoolUsage() throws Exception {
    final Gauge gauge = (Gauge) gauges.getMetrics().get("pools.Weird-Pool.usage");
    assertThat(gauge.getValue()).isEqualTo(3.0);
}
Also used : Gauge(com.codahale.metrics.Gauge) Test(org.junit.Test)

Example 20 with Gauge

use of com.codahale.metrics.Gauge in project newts by OpenNMS.

the class NewtsReporter method report.

@Override
@SuppressWarnings("rawtypes")
public void report(SortedMap<String, Gauge> gauges, SortedMap<String, Counter> counters, SortedMap<String, Histogram> histograms, SortedMap<String, Meter> meters, SortedMap<String, Timer> timers) {
    Timestamp timestamp = Timestamp.fromEpochMillis(clock.getTime());
    List<Sample> samples = Lists.newArrayList();
    for (Map.Entry<String, Gauge> entry : gauges.entrySet()) {
        reportGauge(samples, timestamp, entry.getKey(), entry.getValue());
    }
    for (Map.Entry<String, Counter> entry : counters.entrySet()) {
        reportCounter(samples, timestamp, entry.getKey(), entry.getValue());
    }
    for (Map.Entry<String, Histogram> entry : histograms.entrySet()) {
        reportHistogram(samples, timestamp, entry.getKey(), entry.getValue());
    }
    for (Map.Entry<String, Meter> entry : meters.entrySet()) {
        reportMeter(samples, timestamp, entry.getKey(), entry.getValue());
    }
    for (Map.Entry<String, Timer> entry : timers.entrySet()) {
        reportTimer(samples, timestamp, entry.getKey(), entry.getValue());
    }
    this.repository.insert(samples);
}
Also used : Histogram(com.codahale.metrics.Histogram) Meter(com.codahale.metrics.Meter) Sample(org.opennms.newts.api.Sample) Timestamp(org.opennms.newts.api.Timestamp) Gauge(com.codahale.metrics.Gauge) Counter(com.codahale.metrics.Counter) Timer(com.codahale.metrics.Timer) Map(java.util.Map) SortedMap(java.util.SortedMap)

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