diff --git a/lib/carbon/client.py b/lib/carbon/client.py index 67834cc71..31aa75ae7 100644 --- a/lib/carbon/client.py +++ b/lib/carbon/client.py @@ -12,7 +12,6 @@ from carbon.util import pickle from carbon.util import PluginRegistrar from carbon.util import enableTcpKeepAlive -from carbon.resolver import setUpRandomResolver from carbon import instrumentation, log, pipeline, state try: @@ -29,6 +28,11 @@ except ImportError: log.debug("Couldn't import signal module") +try: + from carbon.resolver import setUpRandomResolver +except ImportError: + setUpRandomResolver = None + SEND_QUEUE_LOW_WATERMARK = settings.MAX_QUEUE_SIZE * settings.QUEUE_LOW_WATERMARK_PCT @@ -528,7 +532,11 @@ def __init__(self, router): # If we decide to open multiple TCP connection to a replica, we probably # want to try to also load-balance accross hosts. In this case we need # to make sure rfc3484 doesn't get in the way. - setUpRandomResolver(reactor) + if setUpRandomResolver: + setUpRandomResolver(reactor) + else: + print("Import error, Twisted >= 17.1.0 needed for using DESTINATION_POOL_REPLICAS.") + raise SystemExit(1) self.router = router self.client_factories = {} # { destination : CarbonClientFactory() }