Search in sources :

Example 66 with Counter

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

the class ExceptionCountMetrics method count.

public void count(Throwable e) {
    Counter c = counters.get(e.getClass());
    if (c == null) {
        synchronized (counters) {
            c = counters.computeIfAbsent(e.getClass(), k -> ActivityMetrics.counter(activityDef, "errorcounts." + e.getClass().getSimpleName()));
        }
    }
    c.inc();
}
Also used : Counter(com.codahale.metrics.Counter) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) ActivityDef(io.engineblock.activityimpl.ActivityDef) 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