[PAN-2354] Handle metrics request closing before response is generated (#1028)

Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
pull/2/head
Adrian Sutton 6 years ago committed by GitHub
parent 5d73677cae
commit 247bc1db4e
  1. 3
      metrics/src/main/java/tech/pegasys/pantheon/metrics/prometheus/MetricsHttpService.java

@ -205,7 +205,10 @@ class MetricsHttpService implements MetricsService {
false,
(res) -> {
if (res.failed()) {
LOG.error("Request for metrics failed", res.cause());
response.setStatusCode(HttpResponseStatus.INTERNAL_SERVER_ERROR.code()).end();
} else if (response.closed()) {
LOG.trace("Request for metrics closed before response was generated");
} else {
response.setStatusCode(HttpResponseStatus.OK.code());
response.putHeader("Content-Type", TextFormat.CONTENT_TYPE_004);

Loading…
Cancel
Save