Skip to content

Commit

Permalink
Re-enable logging during broker version check (#1430)
Browse files Browse the repository at this point in the history
  • Loading branch information
dpkp authored Mar 9, 2018
1 parent eb941ee commit 3dc536a
Showing 1 changed file with 1 addition and 12 deletions.
13 changes: 1 addition & 12 deletions kafka/conn.py
Original file line number Diff line number Diff line change
Expand Up @@ -906,6 +906,7 @@ def check_version(self, timeout=2, strict=False):
Returns: version tuple, i.e. (0, 10), (0, 9), (0, 8, 2), ...
"""
log.info('Probing node %s broker version', self.node_id)
# Monkeypatch some connection configurations to avoid timeouts
override_config = {
'request_timeout_ms': timeout * 1000,
Expand All @@ -924,17 +925,6 @@ def check_version(self, timeout=2, strict=False):
from kafka.protocol.admin import ApiVersionRequest, ListGroupsRequest
from kafka.protocol.commit import OffsetFetchRequest, GroupCoordinatorRequest

# Socket errors are logged as exceptions and can alarm users. Mute them
from logging import Filter

class ConnFilter(Filter):
def filter(self, record):
if record.funcName == 'check_version':
return True
return False
log_filter = ConnFilter()
log.addFilter(log_filter)

test_cases = [
# All cases starting from 0.10 will be based on ApiVersionResponse
((0, 10), ApiVersionRequest[0]()),
Expand Down Expand Up @@ -1004,7 +994,6 @@ def filter(self, record):
else:
raise Errors.UnrecognizedBrokerVersion()

log.removeFilter(log_filter)
for key in stashed:
self.config[key] = stashed[key]
return version
Expand Down

0 comments on commit 3dc536a

Please sign in to comment.