def collect(self):
        metrics = {}

        for filepath in self.PROC:
            if not os.access(filepath, os.R_OK):
                self.log.error('Permission to access %s denied', filepath)
                continue

            header = ''
            data = ''

            # Seek the file for the lines that start with Tcp
            file = open(filepath)

            if not file:
                self.log.error('Failed to open %s', filepath)
                continue

            while True:
                line = file.readline()

                # Reached EOF?
                if len(line) == 0:
                    break

                # Line has metrics?
                if line.startswith("Udp"):
                    header = line
                    data = file.readline()
                    break
            file.close()

            # No data from the file?
            if header == '' or data == '':
                self.log.error('%s has no lines with Udp', filepath)
                continue

            header = header.split()
            data = data.split()

            for i in xrange(1, len(header)):
                metrics[header[i]] = data[i]

        for metric_name in metrics.keys():
            if ((0 > len(self.config['allowed_names']) and
                 metric_name not in self.config['allowed_names'])):
                continue

            value = metrics[metric_name]
            value = self.derivative(metric_name, long(value))

            # Publish the metric
            self.publish(metric_name, value, 0)
dataset/ETHPy150Open python-diamond/Diamond/src/collectors/udp/udp.py/UDPCollector.collect/swapped operands of `>`