Cleanup metrics connections after idle timeout (#2748)

When the prometheus service restarts, connections can be left open and never closed. These connections should close after an idle timeout to avoid causing issues with running out of ports.

Signed-off-by: Paul Harris <paul.harris@consensys.net>
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
pull/2752/head
Paul Harris 3 years ago committed by GitHub
parent 61ae7b0384
commit 75324f3817
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      CHANGELOG.md
  2. 1
      metrics/core/src/main/java/org/hyperledger/besu/metrics/prometheus/MetricsHttpService.java

@ -23,6 +23,7 @@
### Bug Fixes ### Bug Fixes
- Consider effective price and effective priority fee in transaction replacement rules [\#2529](https://github.com/hyperledger/besu/issues/2529) - Consider effective price and effective priority fee in transaction replacement rules [\#2529](https://github.com/hyperledger/besu/issues/2529)
- GetTransactionCount should return the latest transaction count if it is greater than the transaction pool [\#2633](https://github.com/hyperledger/besu/pull/2633) - GetTransactionCount should return the latest transaction count if it is greater than the transaction pool [\#2633](https://github.com/hyperledger/besu/pull/2633)
- Set an idle timeout for metrics connections, to clean up ports when no longer used [\#2748](https://github.com/hyperledger/besu/pull/2748)
### Early Access Features ### Early Access Features

@ -84,6 +84,7 @@ public class MetricsHttpService implements MetricsService {
new HttpServerOptions() new HttpServerOptions()
.setHost(config.getHost()) .setHost(config.getHost())
.setPort(config.getPort()) .setPort(config.getPort())
.setIdleTimeout(60)
.setHandle100ContinueAutomatically(true) .setHandle100ContinueAutomatically(true)
.setCompressionSupported(true)); .setCompressionSupported(true));

Loading…
Cancel
Save