def _collect_stats(self, db, instance_tags):

        metric_scope = [self.STATS_METRICS, self.POOLS_METRICS]

        try:
            cursor = db.cursor()
            for scope in metric_scope:

                cols = scope['metrics'].keys()

                try:
                    query = scope['query']
                    self.log.debug("Running query: %s" % query)
                    cursor.execute(query)

                    results = cursor.fetchall()
                except pg.Error, e:
                    self.log.warning("Not all metrics may be available: %s" % str(e))
                    continue

                for row in results:
                    if row[0] == self.DB_NAME:
                        continue

                    desc = scope['descriptors']
                    assert len(row) == len(cols) + len(desc)

                    tags = instance_tags[:]
                    tags += ["%s:%s" % (d[0][1], d[1]) for d in zip(desc, row[:len(desc)])]

                    values = zip([scope['metrics'][c] for c in cols], row[len(desc):])

                    [v[0][1](self, v[0][0], v[1], tags=tags) for v in values]

            if not results:
                self.warning('No results were found for query: "%s"' % query)

            cursor.close()
        except pg.Error, e:
            self.log.error("Connection error: %s" % str(e))
            raise ShouldRestartException
Returns a predefined set of information gleened from the
dataset/ETHPy150Open serverdensity/sd-agent/checks.d/pgbouncer.py/PgBouncer._collect_stats--crossover with--dataset/ETHPy150Open cloudera/hue/desktop/core/ext-py/pysaml2-2.4.0/src/saml2/response.py/AuthnResponse.session_info