// Used for writing the json for the metrics (see com.codahale.metrics.servlets.MetricsServlet)
// The "false" is to prevent it from printing out all of the values used in the histograms and timers
this.jsonMapper = new ObjectMapper().registerModule(new MetricsModule(RATE_UNIT, DURATION_UNIT, false));
// Register the JVM memory gauges and prefix the keys
MemoryUsageGaugeSet memorySet = new MemoryUsageGaugeSet();
for (String key : memorySet.getMetrics().keySet()) {
metricRegistry.register(MetricRegistry.name("jvm", "memory", key), memorySet.getMetrics().get(key));
}
// By setting this up as a cache, if a counter doesn't exist when we try to retrieve it, it will automatically be created
counters = CacheBuilder.newBuilder().build(
new CacheLoader<String, Counter>() {