Skip to content

Commit

Permalink
DefaultDnsClient reduce log level for TTL > max (#2557)
Browse files Browse the repository at this point in the history
Motivation:
DefaultDnsClient logs at info level if the TTL from DNS
is larger than the maximum configured TTL value. This
level of logging can be noisy in production and not
necessarily be within the client's control.
  • Loading branch information
Scottmitch authored and idelpivnitskiy committed May 2, 2023
1 parent fac100a commit 825f235
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -813,9 +813,11 @@ private void handleResolveDone0(final Future<DnsAnswer<T>> addressFuture,
final List<T> addresses = dnsAnswer.answer();
ttlNanos = dnsAnswer.ttlNanos();
if (ttlNanos > maxTTLNanos) {
LOGGER.info("{} result for {} has a high TTL={}s which is larger than configured maxTTL={}s.",
DefaultDnsClient.this, AbstractDnsPublisher.this,
NANOSECONDS.toSeconds(ttlNanos), NANOSECONDS.toSeconds(maxTTLNanos));
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("{} result for {} has TTL={} > maxTTL={}",
DefaultDnsClient.this, AbstractDnsPublisher.this, NANOSECONDS.toSeconds(ttlNanos),
NANOSECONDS.toSeconds(maxTTLNanos));
}
ttlNanos = maxTTLNanos;
}
final List<ServiceDiscovererEvent<T>> events = calculateDifference(activeAddresses, addresses,
Expand Down

0 comments on commit 825f235

Please sign in to comment.