def _collect_for_instance(self, instance, connection):
        with connection.cursor() as cursor:
            for queue, metrics in self.get_queue_info(instance, cursor):
                for name, metric in metrics.items():
                    self.publish('.'.join((instance, queue, name)), metric)

        with connection.cursor() as cursor:
            consumers = self.get_consumer_info(instance, cursor)
            for queue, consumer, metrics in consumers:
                for name, metric in metrics.items():
                    key_parts = (instance, queue, 'consumers', consumer, name)
                    self.publish('.'.join(key_parts), metric)
Collects metrics for a named connection.
dataset/ETHPy150Open Yelp/fullerite/src/diamond/collectors/pgq/pgq.py/PgQCollector._collect_for_instance