MINOR: reduce StreamThread INFO logging during low traffic
Avoid spamming the logs at the INFO level in a tight loop when there are no new records being polled
Reviewers: Walker Carlson Leah Thomas
@@ -767,9 +767,11 @@ public class StreamThread extends Thread {
// multiple iterations with reasonably large max.num.records and hence is less vulnerable to outliers
taskManager.recordTaskProcessRatio(totalProcessLatency, now);
- log.info("Processed {} total records, ran {} punctuators, and committed {} total tasks " +
- "for active tasks {} and standby tasks {}",
- totalProcessed, totalPunctuated, totalCommitted, taskManager.activeTaskIds(), taskManager.standbyTaskIds());
+ // Don't log summary if no new records were processed to avoid spamming logs for low-traffic topics
+ if (totalProcessed > 0 || totalPunctuated > 0 || totalCommitted > 0) {
+ log.info("Processed {} total records, ran {} punctuators, and committed {} total tasks",
+ totalProcessed, totalPunctuated, totalCommitted);
+ }
}
now = time.milliseconds();
@@ -843,7 +845,9 @@ public class StreamThread extends Thread {
final long pollLatency = advanceNowAndComputeLatency();
final int numRecords = records.count();
+ if (numRecords > 0) {
log.info("Main Consumer poll completed in {} ms and fetched {} records", pollLatency, numRecords);
+ }
pollSensor.record(pollLatency, now);
