

def collect(self):
    hosts = self.config.get('hosts')
    if isinstance(hosts, basestring):
        hosts = [hosts]
    for host in hosts:
        matches = re.search('((.+)\\@)?([^:]+)(:(\\d+))?', host)
        alias = matches.group(2)
        hostname = matches.group(3)
        port = matches.group(5)
        if (alias is None):
            alias = hostname
        stats = self.get_stats(hostname, port)
        desired = stat.config.get('publish', stats.keys())
        for stat in desired:
            if (stat in stats):
                if (stat in self.GAUGES):
                    self.publish_gauge(((alias + '.') + stat), stats[stat])
                else:
                    self.publish_counter(((alias + '.') + stat), stats[stat])
            else:
                self.log.error("No such key '%s' available, issue 'stats' for a full list", stat)

dataset/ETHPy150Open python-diamond/Diamond/src/collectors/memcached/memcached.py MemcachedCollector.collect/VarMisuse@110/130 `self`->`stat`