Skip to content

Commit

Permalink
Reduce log level in RoundRobinLoadBalancer (#2213)
Browse files Browse the repository at this point in the history
Motivation:
RoundRobinLoadBalancer logs at the warn level if it takes
a host out of rotation due to exceeding the consecutive
failure threshold. The failure maybe retried and/or captured
in metrics/logs by the application and may not necessarily
justify a warn level log from the framework.

Modifications:
- Adjust log level to debug when below the failure threshold,
  and info when crossing the threshold. Note the log level is
  also info when the host is connected to again and taken out
  of the penalty box.
  • Loading branch information
Scottmitch authored May 12, 2022
1 parent 11dd16a commit 64f2716
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,7 @@ void markUnhealthy(final Throwable cause, final ConnectionFactory<Addr, ? extend
final ActiveState nextState = previousState.forNextFailedConnection();
if (connStateUpdater.compareAndSet(this, previous,
new ConnState(previous.connections, nextState))) {
LOGGER.info("Load balancer for {}: failed to open a new connection to the host on address {}" +
LOGGER.debug("Load balancer for {}: failed to open a new connection to the host on address {}" +
" {} time(s) ({} consecutive failures will trigger health-checking).",
targetResource, address, nextState.failedConnections,
healthCheckConfig.failedThreshold, cause);
Expand All @@ -592,7 +592,7 @@ void markUnhealthy(final Throwable cause, final ConnectionFactory<Addr, ? extend
final HealthCheck<Addr, C> healthCheck = new HealthCheck<>(connectionFactory, this, cause);
final ConnState nextState = new ConnState(previous.connections, healthCheck);
if (connStateUpdater.compareAndSet(this, previous, nextState)) {
LOGGER.warn("Load balancer for {}: failed to open a new connection to the host on address {} " +
LOGGER.info("Load balancer for {}: failed to open a new connection to the host on address {} " +
"{} time(s) in a row. Error counting threshold reached, marking this host as " +
"UNHEALTHY for the selection algorithm and triggering background health-checking.",
targetResource, address, healthCheckConfig.failedThreshold, cause);
Expand Down

0 comments on commit 64f2716

Please sign in to comment.