@Override
  public CompletableFuture<?> stop() {
    metricsSystem.shutdown();
    final CompletableFuture<?> resultFuture = new CompletableFuture<>();
    try {
      // Calling shutdown now cancels the pending push, which is desirable.
      scheduledExecutorService.shutdownNow();
      scheduledExecutorService.awaitTermination(30, TimeUnit.SECONDS);
      try {
        pushGateway.delete();
      } catch (final Exception e) {
        LOG.error("Could not clean up results on the Prometheus Push Gateway.", e);
        // Do not complete exceptionally, the gateway may be down and failures
        // here cause the shutdown to loop.  Failure is acceptable.
      }
      resultFuture.complete(null);
    } catch (final InterruptedException e) {
      LOG.error("Unable to shutdown push metrics service gracefully", e);
      resultFuture.completeExceptionally(e);
    }
    return resultFuture;
  }
Instantiates a new Metrics push gateway service.

@param configuration the configuration
@param metricsSystem the metrics system
metrics/core/src/main/java/org/hyperledger/besu/metrics/prometheus/MetricsPushGatewayService.java