aboutsummaryrefslogtreecommitdiffstats
path: root/vespa-feed-client
diff options
context:
space:
mode:
authorJon Marius Venstad <venstad@gmail.com>2021-06-25 09:24:38 +0200
committerJon Marius Venstad <venstad@gmail.com>2021-06-25 09:24:38 +0200
commit373b66234f10a0bb4a34fe6032efcc9c49b0dd0a (patch)
tree4aafdbbe47229ed9080dbfd094b27f60e915da7d /vespa-feed-client
parentbe91fbc7f906739a678067de468dc7135d9d9217 (diff)
Lower log level in HttpRequestStrategy
Diffstat (limited to 'vespa-feed-client')
-rw-r--r--vespa-feed-client/src/main/java/ai/vespa/feed/client/GracePeriodCircuitBreaker.java6
-rw-r--r--vespa-feed-client/src/main/java/ai/vespa/feed/client/HttpRequestStrategy.java10
-rw-r--r--vespa-feed-client/src/test/java/ai/vespa/feed/client/HttpRequestStrategyTest.java1
3 files changed, 9 insertions, 8 deletions
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 2c5c2dccf19..c319bfca252 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
@@ -8,7 +8,7 @@ import java.util.function.LongSupplier;
import java.util.logging.Logger;
import static java.util.Objects.requireNonNull;
-import static java.util.logging.Level.INFO;
+import static java.util.logging.Level.FINE;
import static java.util.logging.Level.WARNING;
/**
@@ -48,7 +48,7 @@ public class GracePeriodCircuitBreaker implements FeedClient.CircuitBreaker {
public void success() {
failingSinceMillis.set(NEVER);
if ( ! open.get() && halfOpen.compareAndSet(true, false))
- log.log(INFO, "Circuit breaker is now closed");
+ log.log(FINE, "Circuit breaker is now closed");
}
@Override
@@ -60,7 +60,7 @@ public class GracePeriodCircuitBreaker implements FeedClient.CircuitBreaker {
public State state() {
long failingMillis = clock.getAsLong() - failingSinceMillis.get();
if (failingMillis > graceMillis && halfOpen.compareAndSet(false, true))
- log.log(INFO, "Circuit breaker is now half-open");
+ log.log(FINE, "Circuit breaker is now half-open");
if (failingMillis > doomMillis && open.compareAndSet(false, true))
log.log(WARNING, "Circuit breaker is now open");
diff --git a/vespa-feed-client/src/main/java/ai/vespa/feed/client/HttpRequestStrategy.java b/vespa-feed-client/src/main/java/ai/vespa/feed/client/HttpRequestStrategy.java
index ddfc509738f..71de6ff2065 100644
--- a/vespa-feed-client/src/main/java/ai/vespa/feed/client/HttpRequestStrategy.java
+++ b/vespa-feed-client/src/main/java/ai/vespa/feed/client/HttpRequestStrategy.java
@@ -24,6 +24,7 @@ import static ai.vespa.feed.client.FeedClient.CircuitBreaker.State.HALF_OPEN;
import static ai.vespa.feed.client.FeedClient.CircuitBreaker.State.OPEN;
import static java.nio.charset.StandardCharsets.UTF_8;
import static java.util.logging.Level.FINE;
+import static java.util.logging.Level.FINER;
import static java.util.logging.Level.FINEST;
import static java.util.logging.Level.INFO;
import static java.util.logging.Level.WARNING;
@@ -139,11 +140,11 @@ class HttpRequestStrategy implements RequestStrategy {
if ( (thrown instanceof IOException) // General IO problems.
|| (thrown instanceof CancellationException) // TLS session disconnect.
|| (thrown instanceof CancelledKeyException)) { // Selection cancelled.
- log.log(INFO, thrown, () -> "Failed attempt " + attempt + " at " + request);
+ log.log(FINER, thrown, () -> "Failed attempt " + attempt + " at " + request);
return retry(request, attempt);
}
- log.log(WARNING, thrown, () -> "Failed attempt " + attempt + " at " + request);
+ log.log(FINE, thrown, () -> "Failed attempt " + attempt + " at " + request);
return false;
}
@@ -158,18 +159,17 @@ class HttpRequestStrategy implements RequestStrategy {
if (response.code() == 429 || response.code() == 503) { // Throttling; reduce target inflight.
- logResponse(FINE, response, request, attempt);
+ logResponse(FINER, response, request, attempt);
throttler.throttled((inflight.get() - delayedCount.get()));
return true;
}
breaker.failure();
+ logResponse(FINE, response, request, attempt);
if (response.code() == 500 || response.code() == 502 || response.code() == 504) { // Hopefully temporary errors.
- logResponse(INFO, response, request, attempt);
return retry(request, attempt);
}
- logResponse(WARNING, response, request, attempt);
return false;
}
diff --git a/vespa-feed-client/src/test/java/ai/vespa/feed/client/HttpRequestStrategyTest.java b/vespa-feed-client/src/test/java/ai/vespa/feed/client/HttpRequestStrategyTest.java
index 21ab6889e6e..6b2087b1828 100644
--- a/vespa-feed-client/src/test/java/ai/vespa/feed/client/HttpRequestStrategyTest.java
+++ b/vespa-feed-client/src/test/java/ai/vespa/feed/client/HttpRequestStrategyTest.java
@@ -28,6 +28,7 @@ import static ai.vespa.feed.client.FeedClient.CircuitBreaker.State.OPEN;
import static java.nio.charset.StandardCharsets.UTF_8;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
class HttpRequestStrategyTest {