public long getSize() { return sizeCounter.getCount(); }
@Override public long getNumberOfFailedCalls() { return failedCallsCounter.getCount(); }
@Override public long getNumberOfTotalCalls() { return totalCallsCounter.getCount(); }
@Override public Long incrementCounter(String name, long increment) { String key = name; try { countersLock.lock(); counters.get(key).inc(increment); return counters.get(key).getCount(); } catch (ExecutionException ee) { throw new IllegalStateException("Error retrieving counter from the metric registry ", ee); } finally { countersLock.unlock(); } }
public void verifyStoreMetrics(String storeName, String prefix, Map<String, Long> operationCounts) { for (String operation : OPERATION_NAMES) { Long count = operationCounts.get(operation); if (count==null) count = 0l; assertEquals(Joiner.on(".").join(prefix, storeName, operation, MetricInstrumentedStore.M_CALLS),count.longValue(), metric.getCounter(prefix, storeName, operation, MetricInstrumentedStore.M_CALLS).getCount()); } }
@Override public Long decrementCounter(String name, long decrement) { String key = name; try { countersLock.lock(); counters.get(key).dec(decrement); return counters.get(key).getCount(); } catch(ExecutionException ee) { throw new IllegalStateException("Error retrieving counter from the metric registry ", ee); } finally { countersLock.unlock(); } }
/** * Resets all the counters to 0 for testing. */ public static void resetAllCounters() { for (Map.Entry<String, Counter> entry : METRIC_REGISTRY.getCounters().entrySet()) { entry.getValue().dec(entry.getValue().getCount()); } }
/** * Assign the given stream to this message. * * @param stream the stream to route this message into */ public void addStream(Stream stream) { indexSets.add(stream.getIndexSet()); if (streams.add(stream)) { sizeCounter.inc(8); if (LOG.isTraceEnabled()) { LOG.trace("[Message size update][{}] stream added: {}", getId(), sizeCounter.getCount()); } } }
public void verifyStoreMetrics(String storeName, String prefix, Map<String, Long> operationCounts) { for (String operation : OPERATION_NAMES) { Long count = operationCounts.get(operation); if (count==null) count = 0L; assertEquals(Joiner.on(".").join(prefix, storeName, operation, MetricInstrumentedStore.M_CALLS),count.longValue(), metric.getCounter(prefix, storeName, operation, MetricInstrumentedStore.M_CALLS).getCount()); } }
private long getEdgeCacheRetrievals() { return metric.getCounter(metricsPrefix, EDGESTORE_NAME + METRICS_CACHE_SUFFIX, CacheMetricsAction.RETRIEVAL.getName()).getCount(); }
private long getEdgeCacheMisses() { return metric.getCounter(metricsPrefix, EDGESTORE_NAME + METRICS_CACHE_SUFFIX, CacheMetricsAction.MISS.getName()).getCount(); }
@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); } }
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()); }
public void verifyTypeCacheMetrics(String prefix, int nameMisses, int relationMisses) { // assertEquals("On type cache name retrievals",nameRetrievals, metric.getCounter(GraphDatabaseConfiguration.METRICS_SYSTEM_PREFIX_DEFAULT, METRICS_NAME, METRICS_TYPENAME, CacheMetricsAction.RETRIEVAL.getName()).getCount()); assertEquals("On type cache name misses",nameMisses, metric.getCounter(GraphDatabaseConfiguration.METRICS_SYSTEM_PREFIX_DEFAULT, METRICS_NAME, METRICS_TYPENAME, CacheMetricsAction.MISS.getName()).getCount()); assertTrue(nameMisses <= metric.getCounter(GraphDatabaseConfiguration.METRICS_SYSTEM_PREFIX_DEFAULT, METRICS_NAME, METRICS_TYPENAME, CacheMetricsAction.RETRIEVAL.getName()).getCount()); // assertEquals("On type cache relation retrievals",relationRetrievals, metric.getCounter(GraphDatabaseConfiguration.METRICS_SYSTEM_PREFIX_DEFAULT, METRICS_NAME, METRICS_RELATIONS, CacheMetricsAction.RETRIEVAL.getName()).getCount()); assertEquals("On type cache relation misses", relationMisses, metric.getCounter(GraphDatabaseConfiguration.METRICS_SYSTEM_PREFIX_DEFAULT, METRICS_NAME, METRICS_RELATIONS, CacheMetricsAction.MISS.getName()).getCount()); assertTrue(relationMisses <= metric.getCounter(GraphDatabaseConfiguration.METRICS_SYSTEM_PREFIX_DEFAULT, METRICS_NAME, METRICS_RELATIONS, CacheMetricsAction.RETRIEVAL.getName()).getCount()); }
public void verifyTypeCacheMetrics(String prefix, int nameMisses, int relationMisses) { // assertEquals("On type cache name retrievals",nameRetrievals, metric.getCounter(GraphDatabaseConfiguration.METRICS_SYSTEM_PREFIX_DEFAULT, METRICS_NAME, METRICS_TYPENAME, CacheMetricsAction.RETRIEVAL.getName()).getCount()); assertEquals("On type cache name misses",nameMisses, metric.getCounter(GraphDatabaseConfiguration.METRICS_SYSTEM_PREFIX_DEFAULT, METRICS_NAME, METRICS_TYPENAME, CacheMetricsAction.MISS.getName()).getCount()); assertTrue(nameMisses <= metric.getCounter(GraphDatabaseConfiguration.METRICS_SYSTEM_PREFIX_DEFAULT, METRICS_NAME, METRICS_TYPENAME, CacheMetricsAction.RETRIEVAL.getName()).getCount()); // assertEquals("On type cache relation retrievals",relationRetrievals, metric.getCounter(GraphDatabaseConfiguration.METRICS_SYSTEM_PREFIX_DEFAULT, METRICS_NAME, METRICS_RELATIONS, CacheMetricsAction.RETRIEVAL.getName()).getCount()); assertEquals("On type cache relation misses", relationMisses, metric.getCounter(GraphDatabaseConfiguration.METRICS_SYSTEM_PREFIX_DEFAULT, METRICS_NAME, METRICS_RELATIONS, CacheMetricsAction.MISS.getName()).getCount()); assertTrue(relationMisses <= metric.getCounter(GraphDatabaseConfiguration.METRICS_SYSTEM_PREFIX_DEFAULT, METRICS_NAME, METRICS_RELATIONS, CacheMetricsAction.RETRIEVAL.getName()).getCount()); }
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()); }
private void reportCounter(String name, Counter counter) { final Metric metric = createMetric(name, "counter") .value(counter.getCount()); send(metric); }
private void verifyThatWaitingCompileOpsCountIsEqualTo(long count) { Counter counter = getCounter(WAITING_COMPILE_OPS); assertNotNull(counter); assertThat(counter.getCount(), is(equalTo(count))); }
@Test public void testCount() throws Exception { int runs = 5; for (int i = 0; i < runs; i++) { MetricsFactory.getInstance().incrementCounter("count1"); Counter counter = metricRegistry.getCounters().get("count1"); Assert.assertEquals(i + 1, counter.getCount()); } }