From 247bc1db4ef7aa02d608e1c49340ba90931cce65 Mon Sep 17 00:00:00 2001 From: Adrian Sutton Date: Tue, 5 Mar 2019 08:06:25 +1000 Subject: [PATCH] [PAN-2354] Handle metrics request closing before response is generated (#1028) Signed-off-by: Adrian Sutton --- .../pantheon/metrics/prometheus/MetricsHttpService.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/metrics/src/main/java/tech/pegasys/pantheon/metrics/prometheus/MetricsHttpService.java b/metrics/src/main/java/tech/pegasys/pantheon/metrics/prometheus/MetricsHttpService.java index d5d4cb211a..8b77cceed9 100644 --- a/metrics/src/main/java/tech/pegasys/pantheon/metrics/prometheus/MetricsHttpService.java +++ b/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);