diff options
author | Bjørn Christian Seime <bjorncs@verizonmedia.com> | 2021-08-10 16:53:25 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-10 16:53:25 +0200 |
commit | b120c447fa737576df4956e27c8312bba58b3ea1 (patch) | |
tree | 490eae2d3e950391e1a225682099ccdf74706874 | |
parent | d0f96af1b204ec053e35032a678045a33b03f8b7 (diff) | |
parent | aa47fadc15fe374006ee81bc16a6ff986b12940e (diff) |
Merge pull request #18703 from vespa-engine/jonmv/avoid-closing-stderr
Jonmv/avoid closing stderr
-rw-r--r-- | vespa-feed-client-cli/src/main/java/ai/vespa/feed/client/CliClient.java | 4 | ||||
-rw-r--r-- | vespa-feed-client/src/main/java/ai/vespa/feed/client/GracePeriodCircuitBreaker.java | 8 |
2 files changed, 8 insertions, 4 deletions
diff --git a/vespa-feed-client-cli/src/main/java/ai/vespa/feed/client/CliClient.java b/vespa-feed-client-cli/src/main/java/ai/vespa/feed/client/CliClient.java index 768cdf4c171..bb0bf35dbce 100644 --- a/vespa-feed-client-cli/src/main/java/ai/vespa/feed/client/CliClient.java +++ b/vespa-feed-client-cli/src/main/java/ai/vespa/feed/client/CliClient.java @@ -68,7 +68,7 @@ public class CliClient { } } catch (InterruptedException | IOException ignored) { } // doesn't happen - }); + }, "progress-printer"); progressPrinter.setDaemon(true); progressPrinter.start(); } @@ -152,7 +152,7 @@ public class CliClient { } static void printBenchmarkResult(long durationNanos, OperationStats stats, OutputStream systemOut) throws IOException { - JsonFactory factory = new JsonFactory(); + JsonFactory factory = new JsonFactory().disable(JsonGenerator.Feature.AUTO_CLOSE_TARGET); long okCount = stats.successes(); long errorCount = stats.requests() - okCount; double throughput = okCount * 1e9 / Math.max(1, durationNanos); diff --git a/vespa-feed-client/src/main/java/ai/vespa/feed/client/GracePeriodCircuitBreaker.java b/vespa-feed-client/src/main/java/ai/vespa/feed/client/GracePeriodCircuitBreaker.java index c319bfca252..814d0283140 100644 --- a/vespa-feed-client/src/main/java/ai/vespa/feed/client/GracePeriodCircuitBreaker.java +++ b/vespa-feed-client/src/main/java/ai/vespa/feed/client/GracePeriodCircuitBreaker.java @@ -9,6 +9,7 @@ import java.util.logging.Logger; import static java.util.Objects.requireNonNull; import static java.util.logging.Level.FINE; +import static java.util.logging.Level.INFO; import static java.util.logging.Level.WARNING; /** @@ -60,10 +61,13 @@ public class GracePeriodCircuitBreaker implements FeedClient.CircuitBreaker { public State state() { long failingMillis = clock.getAsLong() - failingSinceMillis.get(); if (failingMillis > graceMillis && halfOpen.compareAndSet(false, true)) - log.log(FINE, "Circuit breaker is now half-open"); + log.log(INFO, "Circuit breaker is now half-open, as no requests have succeeded for the " + + "last " + failingMillis + "ms. The server will be pinged to see if it recovers, " + + "but this client will give up if no successes are observed within " + doomMillis + "ms"); if (failingMillis > doomMillis && open.compareAndSet(false, true)) - log.log(WARNING, "Circuit breaker is now open"); + log.log(WARNING, "Circuit breaker is now open, after " + doomMillis + "ms of failing request, " + + "and this client will give up and abort its remaining feed operations."); return open.get() ? State.OPEN : halfOpen.get() ? State.HALF_OPEN : State.CLOSED; } |