Skip to content

Commit b806979

Browse files
Apoorv JainApoorv Jain
andauthored
ENG-5066: GuavaCacheMetric Support (#33)
* ENG-5066: GuavaCache Metrics Support * ENG 5066: GuavaCache Metric Support * ENG-5066, GuavaCache Metric Support (code formatting fixed) * ENG-5066: GuavaCacheMetric Support, Fixed test-cases * ENG 5066: GuavaCacheMetric; Added test for cache size, Better efficient meter access * ENG 5066: GuavaCacheMetric Support, formatting issues * ENG 5066: GuavaCacheMetrics, Made comments more verbose * ENG 5066: GuavaCacheMetrics, Made comments more verbose * ENG-5066, GuavaCacheMetric Support; Added tags to the cache monitoring meter. * Formatting issue fixed * Formatting issues Co-authored-by: Apoorv Jain <[email protected]>
1 parent 3be16d9 commit b806979

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

platform-metrics/src/main/java/org/hypertrace/core/serviceframework/metrics/PlatformMetricsRegistry.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -380,8 +380,9 @@ public static DistributionSummary registerDistributionSummary(String name,
380380
* Registers metrics for GuavaCaches using micrometer's GuavaCacheMetrics under the given
381381
* cacheName for the given guavaCache
382382
*/
383-
public static <K, V> void registerCache(String cacheName, Cache<K, V> guavaCache) {
384-
GuavaCacheMetrics.monitor(METER_REGISTRY, guavaCache, cacheName);
383+
public static <K, V> void registerCache(String cacheName, Cache<K, V> guavaCache, Map<String, String> tags) {
384+
GuavaCacheMetrics.monitor(METER_REGISTRY, guavaCache, cacheName, addDefaultTags(tags));
385+
385386
}
386387

387388
/**

platform-metrics/src/test/java/org/hypertrace/core/serviceframework/metrics/PlatformMetricsRegistryTest.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,8 +164,7 @@ public void testDistributionSummary() {
164164
public void testCache() throws Exception {
165165
initializeCustomRegistry(List.of("testing"));
166166
Cache<String, Integer> cache = CacheBuilder.newBuilder().maximumSize(10).recordStats().build();
167-
168-
PlatformMetricsRegistry.registerCache("my.cache", cache);
167+
PlatformMetricsRegistry.registerCache("my.cache", cache, Map.of("foo","bar"));
169168
Callable<Integer> loader =
170169
new Callable<Integer>() {
171170
@Override

0 commit comments

Comments
 (0)