This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/master by this push:
     new 5b6d16e  CAMEL-12473 - Use Counter in Caffeine's dropwizard metrics
5b6d16e is described below

commit 5b6d16e4d1f3628251166df86414617e4d3b62fd
Author: Andrea Cosentino <anco...@gmail.com>
AuthorDate: Mon Jun 11 11:45:06 2018 +0200

    CAMEL-12473 - Use Counter in Caffeine's dropwizard metrics
---
 .../CaffeineCacheFromScratchStatsCounterTest.java  |  4 +--
 .../CaffeineCacheStatsCounterProducerTest.java     |  2 +-
 .../caffeine/cache/MetricsStatsCounter.java        | 38 +++++++++++-----------
 3 files changed, 22 insertions(+), 22 deletions(-)

diff --git 
a/components/camel-caffeine/src/test/java/org/apache/camel/component/caffeine/cache/CaffeineCacheFromScratchStatsCounterTest.java
 
b/components/camel-caffeine/src/test/java/org/apache/camel/component/caffeine/cache/CaffeineCacheFromScratchStatsCounterTest.java
index 0309b62..9b6d397 100644
--- 
a/components/camel-caffeine/src/test/java/org/apache/camel/component/caffeine/cache/CaffeineCacheFromScratchStatsCounterTest.java
+++ 
b/components/camel-caffeine/src/test/java/org/apache/camel/component/caffeine/cache/CaffeineCacheFromScratchStatsCounterTest.java
@@ -52,8 +52,8 @@ public class CaffeineCacheFromScratchStatsCounterTest extends 
CamelTestSupport {
 
         fluentTemplate().withHeader(CaffeineConstants.ACTION, 
CaffeineConstants.ACTION_GET).withHeader(CaffeineConstants.KEY, 
12).withBody(3).to("direct://get").send();
 
-        assertEquals(2, metricRegistry.meter("camelcache.hits").getCount());
-        assertEquals(1, metricRegistry.meter("camelcache.misses").getCount());
+        assertEquals(2, metricRegistry.counter("camelcache.hits").getCount());
+        assertEquals(1, 
metricRegistry.counter("camelcache.misses").getCount());
 
     }
 
diff --git 
a/components/camel-caffeine/src/test/java/org/apache/camel/component/caffeine/cache/CaffeineCacheStatsCounterProducerTest.java
 
b/components/camel-caffeine/src/test/java/org/apache/camel/component/caffeine/cache/CaffeineCacheStatsCounterProducerTest.java
index 3d11eba..1f837b3 100644
--- 
a/components/camel-caffeine/src/test/java/org/apache/camel/component/caffeine/cache/CaffeineCacheStatsCounterProducerTest.java
+++ 
b/components/camel-caffeine/src/test/java/org/apache/camel/component/caffeine/cache/CaffeineCacheStatsCounterProducerTest.java
@@ -45,7 +45,7 @@ public class CaffeineCacheStatsCounterProducerTest extends 
CaffeineCacheTestSupp
             assertEquals(map.get(k), elements.get(k));
         });
         
-        assertEquals(2, 
getMetricRegistry().meter("camelcache.hits").getCount());
+        assertEquals(2, 
getMetricRegistry().counter("camelcache.hits").getCount());
     }
 
     // ****************************
diff --git 
a/components/camel-caffeine/src/test/java/org/apache/camel/component/caffeine/cache/MetricsStatsCounter.java
 
b/components/camel-caffeine/src/test/java/org/apache/camel/component/caffeine/cache/MetricsStatsCounter.java
index 85687aa..c2238bb 100644
--- 
a/components/camel-caffeine/src/test/java/org/apache/camel/component/caffeine/cache/MetricsStatsCounter.java
+++ 
b/components/camel-caffeine/src/test/java/org/apache/camel/component/caffeine/cache/MetricsStatsCounter.java
@@ -18,50 +18,50 @@ package org.apache.camel.component.caffeine.cache;
 
 import java.util.concurrent.TimeUnit;
 
-import com.codahale.metrics.Meter;
+import com.codahale.metrics.Counter;
 import com.codahale.metrics.MetricRegistry;
 import com.codahale.metrics.Timer;
 import com.github.benmanes.caffeine.cache.stats.CacheStats;
 import com.github.benmanes.caffeine.cache.stats.StatsCounter;
 
 public class MetricsStatsCounter implements StatsCounter {
-    private final Meter hitCount;
-    private final Meter missCount;
-    private final Meter loadSuccessCount;
-    private final Meter loadFailureCount;
+    private final Counter hitCount;
+    private final Counter missCount;
+    private final Counter loadSuccessCount;
+    private final Counter loadFailureCount;
     private final Timer totalLoadTime;
-    private final Meter evictionCount;
-    private final Meter evictionWeight;
+    private final Counter evictionCount;
+    private final Counter evictionWeight;
 
     public MetricsStatsCounter(MetricRegistry registry) {
-        hitCount = registry.meter("camelcache.hits");
-        missCount = registry.meter("camelcache.misses");
+        hitCount = registry.counter("camelcache.hits");
+        missCount = registry.counter("camelcache.misses");
         totalLoadTime = registry.timer("camelcache.loads");
-        loadSuccessCount = registry.meter("camelcache.loads-success");
-        loadFailureCount = registry.meter("camelcache.loads-failure");
-        evictionCount = registry.meter("camelcache.evictions");
-        evictionWeight = registry.meter("camelcache.evictions-weight");
+        loadSuccessCount = registry.counter("camelcache.loads-success");
+        loadFailureCount = registry.counter("camelcache.loads-failure");
+        evictionCount = registry.counter("camelcache.evictions");
+        evictionWeight = registry.counter("camelcache.evictions-weight");
     }
 
     @Override
     public void recordHits(int count) {
-        hitCount.mark(count);
+        hitCount.inc(count);
     }
 
     @Override
     public void recordMisses(int count) {
-        missCount.mark(count);
+        missCount.inc(count);
     }
 
     @Override
     public void recordLoadSuccess(long loadTime) {
-        loadSuccessCount.mark();
+        loadSuccessCount.inc();
         totalLoadTime.update(loadTime, TimeUnit.NANOSECONDS);
     }
 
     @Override
     public void recordLoadFailure(long loadTime) {
-        loadFailureCount.mark();
+        loadFailureCount.inc();
         totalLoadTime.update(loadTime, TimeUnit.NANOSECONDS);
     }
 
@@ -72,8 +72,8 @@ public class MetricsStatsCounter implements StatsCounter {
 
     @Override
     public void recordEviction(int weight) {
-        evictionCount.mark();
-        evictionWeight.mark(weight);
+        evictionCount.inc();
+        evictionWeight.inc(weight);
     }
 
     @Override

-- 
To stop receiving notification emails like this one, please contact
acosent...@apache.org.

Reply via email to