Source:
private void handleTagNamesMessage(final TagNamesMessage message) { _metrics.recordCounter("rollup/generator/tag_names_message/received", 1); if (message.isFailure()) { _metrics.recordCounter("rollup/generator/tag_names_message/success", 0); LOGGER.warn() .setMessage("Failed to get tag names for metric.") .addData("metricName", message.getMetricName()) .setThrowable(message.getFailure().get()) .log(); getSelf().tell(FETCH_METRIC, ActorRef.noSender()); return; } _metrics.recordCounter("rollup/generator/tag_names_message/success", 1); _periodsInFlight = Lists.newArrayList(RollupPeriod.values()); final String metricName = message.getMetricName(); final long startTime = System.nanoTime(); for (final RollupPeriod period : RollupPeriod.values()) { final int backfillPeriods = _maxBackFillByPeriod.getOrDefault(period, 0); final String rollupMetricName = metricName + period.getSuffix(); final String sourceMetricName = period.previous() .map(RollupPeriod::getSuffix) .map(suffix -> metricName + suffix) .orElse(metricName); if (backfillPeriods > 0) { Patterns.pipe( fetchLastDataPoint(sourceMetricName, rollupMetricName, period, backfillPeriods) .handle((response, failure) -> { final String baseMetricName = "rollup/generator/last_data_point_" + period.name().toLowerCase(Locale.getDefault()); _metrics.recordCounter(baseMetricName + "/success", failure == null ? 1 : 0); _metrics.recordTimer( baseMetricName + "/latency", System.nanoTime() - startTime, Optional.of(Units.NANOSECOND) ); return buildLastDataPointResponse( sourceMetricName, rollupMetricName, period, message.getTagNames(), response, failure ); }), getContext().dispatcher() ).to(getSelf()); } } }

Target:
private void handleTagNamesMessage(final TagNamesMessage message) { _metrics.recordCounter("rollup/generator/tag_names_message/received", 1); if (message.isFailure()) { _metrics.recordCounter("rollup/generator/tag_names_message/success", 0); LOGGER.warn() .setMessage("Failed to get tag names for metric.") .addData("metricName", message.getMetricName()) .setThrowable(message.getFailure().get()) .log(); getSelf().tell(FETCH_METRIC, ActorRef.noSender()); return; } _metrics.recordCounter("rollup/generator/tag_names_message/success", 1); _periodsInFlight = Lists.newArrayList(RollupPeriod.values()); final String metricName = message.getMetricName(); final long startTime = System.nanoTime(); for (final RollupPeriod period : RollupPeriod.values()) { final int backfillPeriods = _maxBackFillByPeriod.getOrDefault(period, 0); if (backfillPeriods > 0) { final String sourceMetricName = getSourceMetricName(metricName, period); final String rollupMetricName = getDestinationMetricName(metricName, period); Patterns.pipe( fetchLastDataPoint(sourceMetricName, rollupMetricName, period, backfillPeriods) .handle((response, failure) -> { final String baseMetricName = "rollup/generator/last_data_point_" + period.name().toLowerCase(Locale.getDefault()); _metrics.recordCounter(baseMetricName + "/success", failure == null ? 1 : 0); _metrics.recordTimer( baseMetricName + "/latency", System.nanoTime() - startTime, Optional.of(Units.NANOSECOND) ); return buildLastDataPointResponse( sourceMetricName, rollupMetricName, period, message.getTagNames(), response, failure ); }), getContext().dispatcher() ).to(getSelf()); } } }