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));
}
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);
}
}
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);
}
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());
}
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;
}
Aggregations