private <O> PipelineBuilder<I, O> addStage(
      final Processor<T, O> processor, final int newBufferSize, final String stageName) {
    final Pipe<O> outputPipe = createPipe(newBufferSize, stageName, outputCounter);
    final Stage processStage = new ProcessingStage<>(stageName, pipeEnd, outputPipe, processor);
    final List<Stage> newStages = concat(stages, processStage);
    return new PipelineBuilder<>(
        inputPipe,
        newStages,
        concat(pipes, outputPipe),
        processStage.getName(),
        outputPipe,
        newBufferSize,
        outputCounter,
        tracingEnabled,
        pipelineName);
  }
End the pipeline with a {@link Consumer} that is the last stage of the pipeline.

@param stageName the name of this stage. Used as the label for the output count metric.
@param completer the {@link Consumer} that accepts the final output of the pipeline.
@return the constructed pipeline ready to execute.
services/pipeline/src/main/java/org/hyperledger/besu/services/pipeline/PipelineBuilder.java