Search in sources :

Example 36 with Counter

use of com.codahale.metrics.Counter in project hive by apache.

the class TestMetricsQueryLifeTimeHook method testExecutionQueryMetric.

@Test
public void testExecutionQueryMetric() {
    Timer timer = metricRegistry.getTimers().get(MetricsConstant.HS2_EXECUTING_QUERIES);
    Counter counter = metricRegistry.getCounters().get(MetricsConstant.ACTIVE_CALLS + MetricsConstant.HS2_EXECUTING_QUERIES);
    assertThat(timer, nullValue());
    assertThat(counter, nullValue());
    hook.beforeExecution(ctx);
    timer = metricRegistry.getTimers().get(MetricsConstant.HS2_EXECUTING_QUERIES);
    counter = metricRegistry.getCounters().get(MetricsConstant.ACTIVE_CALLS + MetricsConstant.HS2_EXECUTING_QUERIES);
    assertThat(timer.getCount(), equalTo(0l));
    assertThat(counter.getCount(), equalTo(1l));
    hook.afterExecution(ctx, false);
    timer = metricRegistry.getTimers().get(MetricsConstant.HS2_EXECUTING_QUERIES);
    counter = metricRegistry.getCounters().get(MetricsConstant.ACTIVE_CALLS + MetricsConstant.HS2_EXECUTING_QUERIES);
    assertThat(timer.getCount(), equalTo(1l));
    assertThat(counter.getCount(), equalTo(0l));
}
Also used : Counter(com.codahale.metrics.Counter) Timer(com.codahale.metrics.Timer) Test(org.junit.Test)

Example 37 with Counter

use of com.codahale.metrics.Counter in project jstorm by alibaba.

the class AsmCounter method updateSnapshot.

@Override
protected void updateSnapshot(int window) {
    Counter counter = counterMap.get(window);
    if (counter != null) {
        AsmSnapshot snapshot = new AsmCounterSnapshot().setValue(counter.getCount()).setTs(System.currentTimeMillis()).setMetricId(metricId);
        snapshots.put(window, snapshot);
    }
}
Also used : Counter(com.codahale.metrics.Counter) AsmSnapshot(com.alibaba.jstorm.common.metric.snapshot.AsmSnapshot) AsmCounterSnapshot(com.alibaba.jstorm.common.metric.snapshot.AsmCounterSnapshot)

Example 38 with Counter

use of com.codahale.metrics.Counter in project jstorm by alibaba.

the class AsmCounter method doFlush.

/**
     * flush temp counter data to all windows & assoc metrics.
     */
protected void doFlush() {
    long v;
    synchronized (unFlushed) {
        v = unFlushed.getCount();
    }
    for (Counter counter : counterMap.values()) {
        counter.inc(v);
    }
    if (MetricUtils.metricAccurateCal) {
        for (AsmMetric assocMetric : assocMetrics) {
            assocMetric.updateDirectly(v);
        }
    }
    this.unFlushed.dec(v);
}
Also used : Counter(com.codahale.metrics.Counter)

Example 39 with Counter

use of com.codahale.metrics.Counter in project titan by thinkaurelius.

the class TitanOperationCountingTest method resetEdgeCacheCounts.

private void resetEdgeCacheCounts() {
    Counter counter = metric.getCounter(metricsPrefix, EDGESTORE_NAME + METRICS_CACHE_SUFFIX, CacheMetricsAction.RETRIEVAL.getName());
    counter.dec(counter.getCount());
    counter = metric.getCounter(metricsPrefix, EDGESTORE_NAME + METRICS_CACHE_SUFFIX, CacheMetricsAction.MISS.getName());
    counter.dec(counter.getCount());
}
Also used : Counter(com.codahale.metrics.Counter)

Example 40 with Counter

use of com.codahale.metrics.Counter in project torodb by torodb.

the class ToroMetricRegistry method counter.

public Counter counter(MetricName name) {
    mbeanNameFactory.registerName(name);
    Counter counter = counter(name.getMetricName());
    return counter;
}
Also used : Counter(com.codahale.metrics.Counter)

Aggregations

Counter (com.codahale.metrics.Counter)66 Test (org.junit.Test)31 Map (java.util.Map)15 MetricRegistry (com.codahale.metrics.MetricRegistry)14 Timer (com.codahale.metrics.Timer)14 Histogram (com.codahale.metrics.Histogram)11 HashMap (java.util.HashMap)11 Gauge (com.codahale.metrics.Gauge)10 Meter (com.codahale.metrics.Meter)9 Metric (com.codahale.metrics.Metric)9 Random (java.util.Random)8 SolrInfoBean (org.apache.solr.core.SolrInfoBean)6 SortedMap (java.util.SortedMap)5 IOException (java.io.IOException)4 TreeMap (java.util.TreeMap)4 JettySolrRunner (org.apache.solr.client.solrj.embedded.JettySolrRunner)4 SolrMetricManager (org.apache.solr.metrics.SolrMetricManager)4 Description (com.google.gerrit.metrics.Description)3 ArrayList (java.util.ArrayList)3 Collectors (java.util.stream.Collectors)3