Skip to content

Commit

Permalink
[improve][client] Print consumer stats log if prefetched messages are…
Browse files Browse the repository at this point in the history
… not zero (#23698)
  • Loading branch information
codelipenghui authored Dec 12, 2024
1 parent f571aa1 commit c52af1d
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -146,15 +146,16 @@ private void init(ConsumerConfigurationData<?> conf) {

receivedMsgsRate = currentNumMsgsReceived / elapsed;
receivedBytesRate = currentNumBytesReceived / elapsed;
int prefetchQueueSize = consumerImpl.incomingMessages.size();
if ((currentNumMsgsReceived | currentNumBytesReceived | currentNumReceiveFailed | currentNumAcksSent
| currentNumAcksFailed) != 0) {
| currentNumAcksFailed | prefetchQueueSize) != 0) {
log.info(
"[{}] [{}] [{}] Prefetched messages: {} --- "
+ "Consume throughput received: {} msgs/s --- {} Mbit/s --- "
+ "Ack sent rate: {} ack/s --- " + "Failed messages: {} --- batch messages: {} ---"
+ "Failed acks: {}",
consumerImpl.getTopic(), consumerImpl.getSubscription(), consumerImpl.consumerName,
consumerImpl.incomingMessages.size(), THROUGHPUT_FORMAT.format(receivedMsgsRate),
prefetchQueueSize, THROUGHPUT_FORMAT.format(receivedMsgsRate),
THROUGHPUT_FORMAT.format(receivedBytesRate * 8 / 1024 / 1024),
THROUGHPUT_FORMAT.format(currentNumAcksSent / elapsed), currentNumReceiveFailed,
currentNumBatchReceiveFailed, currentNumAcksFailed);
Expand Down

0 comments on commit c52af1d

Please # to comment.