old_contents: from icrawl_plugin import IContainerCrawler
  from dockercontainer import DockerContainer
  from plugins.applications.redis import feature
  from requests.exceptions import ConnectionError
  import redis
  import logging
  
  logger = logging.getLogger('crawlutils')
  
  
  class RedisContainerCrawler(IContainerCrawler):
      '''
      Crawling app provided metrics for redis container on docker.
      Usually redis listens on port 6379.
      '''
  
      feature_type = "application"
      feature_key = "redis"
      default_port = 6379
  
      def get_feature(self):
          return self.feature_type
  
      def crawl(self, container_id=None, **kwargs):
  
          # only crawl redis container. Otherwise, quit.
          c = DockerContainer(container_id)
          if c.image_name.find(self.feature_key) == -1:
              logger.debug("%s is not %s container" % (c.image_name, self.feature_key))
              return
  
          # extract IP and Port information
          ip = c.get_container_ip()
          ports = c.get_container_ports()
  
          # set default port number
          if len(ports) == 0:
              ports.append(self.default_port)
  
          # query to all available ports
          for port in ports:
              client = redis.Redis(host=ip, port=port)
              try:
                  metrics = client.info()
              except ConnectionError:
                  logger.info("redis does not listen on port:%d", port)
                  continue
              feature_attributes = feature.create_feature(metrics)
              return [(self.feature_key, feature_attributes, self.feature_type)]
  
new_contents: from icrawl_plugin import IContainerCrawler
  from dockercontainer import DockerContainer
  from plugins.applications.redis import feature
  from requests.exceptions import ConnectionError
  import redis
  import logging
  
  logger = logging.getLogger('crawlutils')
  
  
  class RedisContainerCrawler(IContainerCrawler):
      '''
      Crawling app provided metrics for redis container on docker.
      Usually redis listens on port 6379.
      '''
  
      feature_type = "application"
      feature_key = "redis"
      default_port = 6379
  
      def get_feature(self):
          return self.feature_type
  
      def crawl(self, container_id=None, **kwargs):
  
          # only crawl redis container. Otherwise, quit.
          c = DockerContainer(container_id)
          if c.image_name.find(self.feature_key) == -1:
              logger.debug("%s is not %s container" %
                           (c.image_name, self.feature_key))
              return
  
          # extract IP and Port information
          ip = c.get_container_ip()
          ports = c.get_container_ports()
  
          # set default port number
          if len(ports) == 0:
              ports.append(self.default_port)
  
          # query to all available ports
          for port in ports:
              client = redis.Redis(host=ip, port=port)
              try:
                  metrics = client.info()
              except ConnectionError:
                  logger.info("redis does not listen on port:%d", port)
                  continue
              feature_attributes = feature.create_feature(metrics)
              return [(self.feature_key, feature_attributes, self.feature_type)]
  
subject: fix too long line