Source:
private void executorFinished(final RollupExecutor.FinishRollupMessage message) { final RollupDefinition definition = message.getRollupDefinition(); final double latencyNs = (double) Duration.between(definition.getStartTime(), Instant.now()).toNanos(); try (Metrics metrics = _metricsFactory.create()) { metrics.addAnnotation("rollup_metric", definition.getDestinationMetricName()); metrics.incrementCounter("rollup/manager/executor_finished", 1); metrics.setGauge("rollup/manager/executor_finished/latency_sec", latencyNs / 1e9); metrics.setGauge( "rollup/manager/executor_finished/latency_periods", latencyNs / definition.getPeriod().periodCountToDuration(1).toNanos() ); final Optional<Throwable> failure = message.getFailure(); if (!failure.isPresent()) { metrics.addAnnotation("outcome", "success"); return; } final boolean isRetryable = _partitioner.mightSplittingFixFailure(failure.get()); if (!isRetryable) { LOGGER.warn() .setMessage("giving up after non-retryable error") .addData("rollupDefinition", message.getRollupDefinition()) .setThrowable(failure.get()) .log(); metrics.addAnnotation("outcome", "non_retryable_error"); return; } final ImmutableSet<RollupDefinition> children; try { children = _partitioner.splitJob(definition); } catch (final RollupPartitioner.CannotSplitException e) { LOGGER.error() .setMessage("giving up on job that can't be split any more") .addData("rollupDefinition", definition) .setThrowable(failure.get()) .log(); metrics.addAnnotation("outcome", "unable_to_split"); return; } LOGGER.info() .setMessage("splitting and retrying job") .addData("parent", definition) .addData("children", children) .setThrowable(failure.get()) .log(); metrics.addAnnotation("outcome", "split_and_retry"); children.forEach(child -> getSelf().tell(child, getSelf())); } }

Target:
private void executorFinished(final RollupExecutor.FinishRollupMessage message) { final RollupDefinition definition = message.getRollupDefinition(); final double latencyNs = (double) Duration.between(definition.getEndTime(), Instant.now()).toNanos(); try (Metrics metrics = _metricsFactory.create()) { metrics.addAnnotation("rollup_metric", definition.getDestinationMetricName()); metrics.incrementCounter("rollup/manager/executor_finished", 1); metrics.setGauge("rollup/manager/executor_finished/latency_sec", latencyNs / 1e9); final Optional<Throwable> failure = message.getFailure(); if (!failure.isPresent()) { LOGGER.trace() .setMessage("rollup finished successfully") .addData("rollupDefinition", message.getRollupDefinition()) .log(); metrics.addAnnotation("outcome", "success"); return; } final boolean isRetryable = _partitioner.mightSplittingFixFailure(failure.get()); if (!isRetryable) { LOGGER.warn() .setMessage("giving up after non-retryable error") .addData("rollupDefinition", message.getRollupDefinition()) .setThrowable(failure.get()) .log(); metrics.addAnnotation("outcome", "non_retryable_error"); return; } final ImmutableSet<RollupDefinition> children; try { children = _partitioner.splitJob(definition); } catch (final RollupPartitioner.CannotSplitException e) { LOGGER.error() .setMessage("giving up on job that can't be split any more") .addData("rollupDefinition", definition) .setThrowable(failure.get()) .log(); metrics.addAnnotation("outcome", "unable_to_split"); return; } LOGGER.info() .setMessage("splitting and retrying job") .addData("parent", definition) .addData("children", children) .setThrowable(failure.get()) .log(); metrics.addAnnotation("outcome", "split_and_retry"); children.forEach(child -> getSelf().tell(child, getSelf())); } }