Source:
public DeltaCounterAccumulationHandlerImpl(final String handle, final int blockedItemsPerBatch, final Collection<SenderTask> senderTasks, @Nullable final Supplier<ValidationConfiguration> validationConfig, long deltaCountersAggregationIntervalSeconds) { super(ReportableEntityType.DELTA_COUNTER, handle, blockedItemsPerBatch, new ReportPointSerializer(), senderTasks, validationConfig, "pps", true); this.metricCache = Caffeine.newBuilder(). expireAfterWrite(15, TimeUnit.MINUTES). removalListener((RemovalListener<HostMetricTagsPair, AtomicDouble>) (metric, value, reason) -> this.reportDeltaCounter(metric, value)).build(); String logPointsProperty = System.getProperty("wavefront.proxy.logpoints"); this.logPointsFlag = logPointsProperty != null && logPointsProperty.equalsIgnoreCase("true"); String logPointsSampleRateProperty = System.getProperty("wavefront.proxy.logpoints.sample-rate"); this.logSampleRate = NumberUtils.isNumber(logPointsSampleRateProperty) ? Double.parseDouble(logPointsSampleRateProperty) : 1.0d; MetricsRegistry registry = Metrics.defaultRegistry(); this.receivedPointLag = registry.newHistogram(new MetricName("points." + handle + ".received", "", "lag"), false); deltaCounterReporter.scheduleWithFixedDelay(this::reportCache, deltaCountersAggregationIntervalSeconds, deltaCountersAggregationIntervalSeconds, TimeUnit.SECONDS); String metricPrefix = entityType.toString() + "." + handle; this.reportedCounter = registry.newCounter(new MetricName(metricPrefix, "", "sent")); Metrics.newGauge(new MetricName(metricPrefix, "", "accumulator.size"), new Gauge<Long>() { @Override public Long value() { return metricCache.estimatedSize(); } }); }

Target:
public DeltaCounterAccumulationHandlerImpl(final String handle, final int blockedItemsPerBatch, final Collection<SenderTask> senderTasks, @Nullable final Supplier<ValidationConfiguration> validationConfig, long deltaCountersAggregationIntervalSeconds) { super(ReportableEntityType.DELTA_COUNTER, handle, blockedItemsPerBatch, new ReportPointSerializer(), senderTasks, validationConfig, "pps", true); this.aggregatedDeltas = Caffeine.newBuilder(). expireAfterAccess(5 * deltaCountersAggregationIntervalSeconds, TimeUnit.SECONDS). removalListener((RemovalListener<HostMetricTagsPair, AtomicDouble>) (metric, value, reason) -> this.reportAggregatedDeltaValue(metric, value)).build(); String logPointsProperty = System.getProperty("wavefront.proxy.logpoints"); this.logPointsFlag = logPointsProperty != null && logPointsProperty.equalsIgnoreCase("true"); String logPointsSampleRateProperty = System.getProperty("wavefront.proxy.logpoints.sample-rate"); this.logSampleRate = NumberUtils.isNumber(logPointsSampleRateProperty) ? Double.parseDouble(logPointsSampleRateProperty) : 1.0d; this.receivedPointLag = Metrics.newHistogram(new MetricName("points." + handle + ".received", "", "lag"), false); deltaCounterReporter.scheduleWithFixedDelay(this::reportCache, deltaCountersAggregationIntervalSeconds, deltaCountersAggregationIntervalSeconds, TimeUnit.SECONDS); String metricPrefix = entityType.toString() + "." + handle; this.reportedCounter = Metrics.newCounter(new MetricName(metricPrefix, "", "sent")); Metrics.newGauge(new MetricName(metricPrefix, "", "accumulator.size"), new Gauge<Long>() { @Override public Long value() { return aggregatedDeltas.estimatedSize(); } }); }