Suppress LeaseAssignmentManager excessive WARN logs when there is no issue (#1437)

This commit fixes https://github.com/awslabs/amazon-kinesis-client/issues/1407. The WARN level log statements should only be executed when a real problem had been detected.
This commit is contained in:
ivanlkc 2025-02-06 20:20:19 -05:00 committed by GitHub
parent ae9a433ebd
commit 68a7a9bf53
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -537,8 +537,8 @@ public final class LeaseAssignmentManager {
.filter(workerMetrics -> !workerMetrics.isValidWorkerMetric())
.map(WorkerMetricStats::getWorkerId)
.collect(Collectors.toList());
log.warn("List of workerIds with invalid entries : {}", listOfWorkerIdOfInvalidWorkerMetricsEntry);
if (!listOfWorkerIdOfInvalidWorkerMetricsEntry.isEmpty()) {
log.warn("List of workerIds with invalid entries : {}", listOfWorkerIdOfInvalidWorkerMetricsEntry);
metricsScope.addData(
"NumWorkersWithInvalidEntry",
listOfWorkerIdOfInvalidWorkerMetricsEntry.size(),
@ -567,8 +567,8 @@ public final class LeaseAssignmentManager {
final Map.Entry<List<Lease>, List<String>> leaseListResponse = leaseListFuture.join();
this.leaseList = leaseListResponse.getKey();
log.warn("Leases that failed deserialization : {}", leaseListResponse.getValue());
if (!leaseListResponse.getValue().isEmpty()) {
log.warn("Leases that failed deserialization : {}", leaseListResponse.getValue());
MetricsUtil.addCount(
metricsScope,
"LeaseDeserializationFailureCount",