Source:
<code>public DeltaCounterAccumulationHandlerImpl( final HandlerKey handlerKey, final int blockedItemsPerBatch, @Nullable final Collection<SenderTask<String>> senderTasks, @Nonnull final ValidationConfiguration validationConfig, long aggregationIntervalSeconds, @Nullable final Consumer<Long> receivedRateSink, @Nullable final Logger blockedItemLogger, @Nullable final Logger validItemsLogger) { super(handlerKey, blockedItemsPerBatch, new ReportPointSerializer(), senderTasks, true, null, blockedItemLogger); this.validationConfig = validationConfig; this.validItemsLogger = validItemsLogger; this.aggregatedDeltas = Caffeine.newBuilder(). expireAfterAccess(5 * aggregationIntervalSeconds, TimeUnit.SECONDS). removalListener((RemovalListener<HostMetricTagsPair, AtomicDouble>) (metric, value, reason) -> this.reportAggregatedDeltaValue(metric, value)).build(); this.receivedPointLag = Metrics.newHistogram(new MetricName("points." + handlerKey.getHandle() + ".received", "", "lag"), false); reporter.scheduleWithFixedDelay(this::flushDeltaCounters, aggregationIntervalSeconds, aggregationIntervalSeconds, TimeUnit.SECONDS); String metricPrefix = handlerKey.toString(); MetricName reported = new MetricName(metricPrefix, "", "sent"); this.reportedCounter = Metrics.newCounter(reported); <START> this.reportedStats = new BurstRateTrackingCounter(reported, Metrics.defaultRegistry(), 1000); <END> this.discardedCounterSupplier = Utils.lazySupplier(() -> Metrics.newCounter(new MetricName(metricPrefix, "", "discarded"))); Metrics.newGauge(new MetricName(metricPrefix, "", "accumulator.size"), new Gauge<Long>() { @Override public Long value() { return aggregatedDeltas.estimatedSize(); } }); if (receivedRateSink == null) { this.receivedRateTimer = null; } else { this.receivedRateTimer = new Timer("delta-counter-timer-" + handlerKey.getHandle()); this.receivedRateTimer.scheduleAtFixedRate(new TimerTask() { @Override public void run() { receivedRateSink.accept(reportedStats.getCurrentRate()); } }, 1000, 1000); } }</code><technical_language>updating this.reportStats? reportedCounter is incremented, reportedStats update, due shared MetricName</technical_language>

Target:
public DeltaCounterAccumulationHandlerImpl( final HandlerKey handlerKey, final int blockedItemsPerBatch, @Nullable final Collection<SenderTask<String>> senderTasks, @Nonnull final ValidationConfiguration validationConfig, long aggregationIntervalSeconds, @Nullable final Consumer<Long> receivedRateSink, @Nullable final Logger blockedItemLogger, @Nullable final Logger validItemsLogger) { super(handlerKey, blockedItemsPerBatch, new ReportPointSerializer(), senderTasks, true, null, blockedItemLogger); this.validationConfig = validationConfig; this.validItemsLogger = validItemsLogger; this.aggregatedDeltas = Caffeine.newBuilder(). expireAfterAccess(5 * aggregationIntervalSeconds, TimeUnit.SECONDS). removalListener((RemovalListener<HostMetricTagsPair, AtomicDouble>) (metric, value, reason) -> this.reportAggregatedDeltaValue(metric, value)).build(); this.receivedPointLag = Metrics.newHistogram(new MetricName("points." + handlerKey.getHandle() + ".received", "", "lag"), false); reporter.scheduleWithFixedDelay(this::flushDeltaCounters, aggregationIntervalSeconds, aggregationIntervalSeconds, TimeUnit.SECONDS); String metricPrefix = handlerKey.toString(); this.reportedStats = new BurstRateTrackingCounter(new MetricName(metricPrefix, "", "sent"), Metrics.defaultRegistry(), 1000); this.discardedCounterSupplier = Utils.lazySupplier(() -> Metrics.newCounter(new MetricName(metricPrefix, "", "discarded"))); Metrics.newGauge(new MetricName(metricPrefix, "", "accumulator.size"), new Gauge<Long>() { @Override public Long value() { return aggregatedDeltas.estimatedSize(); } }); if (receivedRateSink == null) { this.receivedRateTimer = null; } else { this.receivedRateTimer = new Timer("delta-counter-timer-" + handlerKey.getHandle()); this.receivedRateTimer.scheduleAtFixedRate(new TimerTask() { @Override public void run() { receivedRateSink.accept(reportedStats.getCurrentRate()); } }, 1000, 1000); } }