Skip to content

Commit 86d98c0

Browse files
committed
Log successful heartbeat as INFO; improve heartbeat response logging
1 parent 0057e75 commit 86d98c0

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

kafka/coordinator/base.py

+12-11
Original file line numberDiff line numberDiff line change
@@ -536,26 +536,27 @@ def _handle_heartbeat_response(self, future, response):
536536
#self.sensors.heartbeat_latency.record(response.requestLatencyMs())
537537
error_type = Errors.for_code(response.error_code)
538538
if error_type is Errors.NoError:
539-
log.debug("Received successful heartbeat response.")
539+
log.info("Heartbeat successful")
540540
future.success(None)
541541
elif error_type in (Errors.GroupCoordinatorNotAvailableError,
542542
Errors.NotCoordinatorForGroupError):
543-
log.info("Heartbeat failed: coordinator is either not started or"
544-
" not valid; will refresh metadata and retry")
543+
log.warning("Heartbeat failed: coordinator is either not started or"
544+
" not valid; will refresh metadata and retry")
545545
self.coordinator_dead()
546546
future.failure(error_type())
547547
elif error_type is Errors.RebalanceInProgressError:
548-
log.info("Heartbeat failed: group is rebalancing; re-joining group")
548+
log.warning("Heartbeat: group is rebalancing; this consumer needs to"
549+
" re-join")
549550
self.rejoin_needed = True
550551
future.failure(error_type())
551552
elif error_type is Errors.IllegalGenerationError:
552-
log.info("Heartbeat failed: local generation id is not current;"
553-
" re-joining group")
553+
log.warning("Heartbeat: generation id is not current; this consumer"
554+
" needs to re-join")
554555
self.rejoin_needed = True
555556
future.failure(error_type())
556557
elif error_type is Errors.UnknownMemberIdError:
557-
log.info("Heartbeat failed: local member_id was not recognized;"
558-
" resetting and re-joining group")
558+
log.warning("Heartbeat: local member_id was not recognized;"
559+
" this consumer needs to re-join")
559560
self.member_id = JoinGroupRequest.UNKNOWN_MEMBER_ID
560561
self.rejoin_needed = True
561562
future.failure(error_type)
@@ -597,8 +598,8 @@ def __call__(self):
597598
self._coordinator.need_rejoin()):
598599
# no need to send the heartbeat we're not using auto-assignment
599600
# or if we are awaiting a rebalance
600-
log.debug("Skipping heartbeat: no auto-assignment"
601-
" or waiting on rebalance")
601+
log.info("Skipping heartbeat: no auto-assignment"
602+
" or waiting on rebalance")
602603
return
603604

604605
if self._coordinator.coordinator_unknown():
@@ -633,7 +634,7 @@ def _handle_heartbeat_success(self, v):
633634
self._client.schedule(self, time.time() + ttl)
634635

635636
def _handle_heartbeat_failure(self, e):
636-
log.debug("Heartbeat failed; retrying")
637+
log.warning("Heartbeat failed; retrying")
637638
self._request_in_flight = False
638639
etd = time.time() + self._coordinator.config['retry_backoff_ms'] / 1000.0
639640
self._client.schedule(self, etd)

0 commit comments

Comments
 (0)