Projects
openEuler:24.03:SP1:Everything
metrics
_service:tar_scm:metrics-3.1.2-ehcache-core.patch
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File _service:tar_scm:metrics-3.1.2-ehcache-core.patch of Package metrics
diff -Nru metrics-3.1.2/metrics-ehcache/src/main/java/com/codahale/metrics/ehcache/InstrumentedEhcache.java metrics-3.1.2.ehcache-core/metrics-ehcache/src/main/java/com/codahale/metrics/ehcache/InstrumentedEhcache.java --- metrics-3.1.2/metrics-ehcache/src/main/java/com/codahale/metrics/ehcache/InstrumentedEhcache.java 2015-04-26 05:55:19.000000000 +0200 +++ metrics-3.1.2.ehcache-core/metrics-ehcache/src/main/java/com/codahale/metrics/ehcache/InstrumentedEhcache.java 2015-07-03 04:02:58.188731651 +0200 @@ -6,8 +6,9 @@ import net.sf.ehcache.CacheException; import net.sf.ehcache.Ehcache; import net.sf.ehcache.Element; +import net.sf.ehcache.Statistics; import net.sf.ehcache.constructs.EhcacheDecoratorAdapter; -import net.sf.ehcache.statistics.StatisticsGateway; +import net.sf.ehcache.statistics.LiveCacheStatistics; import java.io.Serializable; @@ -113,16 +114,18 @@ * @param cache an {@link Ehcache} instance * @param registry a {@link MetricRegistry} * @return an instrumented decorator for {@code cache} - * @see StatisticsGateway + * @see LiveCacheStatistics */ public static Ehcache instrument(MetricRegistry registry, final Ehcache cache) { + cache.setSampledStatisticsEnabled(true); + cache.setStatisticsAccuracy(Statistics.STATISTICS_ACCURACY_NONE); final String prefix = name(cache.getClass(), cache.getName()); registry.register(name(prefix, "hits"), new Gauge<Long>() { @Override public Long getValue() { - return cache.getStatistics().cacheHitCount(); + return cache.getStatistics().getCacheHits(); } }); @@ -130,7 +133,7 @@ new Gauge<Long>() { @Override public Long getValue() { - return cache.getStatistics().localHeapHitCount(); + return cache.getStatistics().getInMemoryHits(); } }); @@ -138,7 +141,7 @@ new Gauge<Long>() { @Override public Long getValue() { - return cache.getStatistics().localOffHeapHitCount(); + return cache.getStatistics().getOffHeapHits(); } }); @@ -146,7 +149,7 @@ new Gauge<Long>() { @Override public Long getValue() { - return cache.getStatistics().localDiskHitCount(); + return cache.getStatistics().getOnDiskHits(); } }); @@ -154,7 +157,7 @@ new Gauge<Long>() { @Override public Long getValue() { - return cache.getStatistics().cacheMissCount(); + return cache.getStatistics().getCacheMisses(); } }); @@ -162,7 +165,7 @@ new Gauge<Long>() { @Override public Long getValue() { - return cache.getStatistics().localHeapMissCount(); + return cache.getStatistics().getInMemoryMisses(); } }); @@ -170,7 +173,7 @@ new Gauge<Long>() { @Override public Long getValue() { - return cache.getStatistics().localOffHeapMissCount(); + return cache.getStatistics().getOffHeapMisses(); } }); @@ -178,7 +181,7 @@ new Gauge<Long>() { @Override public Long getValue() { - return cache.getStatistics().localDiskMissCount(); + return cache.getStatistics().getOnDiskMisses(); } }); @@ -186,7 +189,7 @@ new Gauge<Long>() { @Override public Long getValue() { - return cache.getStatistics().getSize(); + return cache.getStatistics().getObjectCount(); } }); @@ -194,7 +197,7 @@ new Gauge<Long>() { @Override public Long getValue() { - return cache.getStatistics().getLocalHeapSize(); + return cache.getStatistics().getMemoryStoreObjectCount(); } }); @@ -202,7 +205,7 @@ new Gauge<Long>() { @Override public Long getValue() { - return cache.getStatistics().getLocalOffHeapSize(); + return cache.getStatistics().getOffHeapStoreObjectCount(); } }); @@ -210,23 +213,23 @@ new Gauge<Long>() { @Override public Long getValue() { - return cache.getStatistics().getLocalDiskSize(); + return cache.getStatistics().getDiskStoreObjectCount(); } }); registry.register(name(prefix, "mean-get-time"), - new Gauge<Double>() { + new Gauge<Float>() { @Override - public Double getValue() { - return cache.getStatistics().cacheGetOperation().latency().average().value(); + public Float getValue() { + return cache.getStatistics().getAverageGetTime(); } }); registry.register(name(prefix, "mean-search-time"), - new Gauge<Double>() { + new Gauge<Long>() { @Override - public Double getValue() { - return cache.getStatistics().cacheSearchOperation().latency().average().value(); + public Long getValue() { + return cache.getStatistics().getAverageSearchTime(); } }); @@ -234,15 +237,15 @@ new Gauge<Long>() { @Override public Long getValue() { - return cache.getStatistics().cacheEvictionOperation().count().value(); + return cache.getStatistics().getEvictionCount(); } }); registry.register(name(prefix, "searches-per-second"), - new Gauge<Double>() { + new Gauge<Long>() { @Override - public Double getValue() { - return cache.getStatistics().cacheSearchOperation().rate().value(); + public Long getValue() { + return cache.getStatistics().getSearchesPerSecond(); } }); @@ -250,7 +253,16 @@ new Gauge<Long>() { @Override public Long getValue() { - return cache.getStatistics().getWriterQueueLength(); + return cache.getStatistics().getWriterQueueSize(); + } + }); + + registry.register(name(prefix, "accuracy"), + new Gauge<String>() { + @Override + public String getValue() { + return cache.getStatistics() + .getStatisticsAccuracyDescription(); } });
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.
浙ICP备2022010568号-2