(self, version)
return {'descriptors': [('datname', 'db')], 'metrics': metrics, 'query': query, 'relation': False}
Use ACTIVITY_METRICS_LT_8_3 or ACTIVITY_METRICS_8_3 or ACTIVITY_METRICS_9_2
        depending on the postgres version in conjunction with ACTIVITY_QUERY_10 or ACTIVITY_QUERY_LT_10.
        Uses a dictionary to save the result for each instance
Use ACTIVITY_METRICS_LT_8_3 or ACTIVITY_METRICS_8_3 or ACTIVITY_METRICS_9_2
        depending on the postgres version in conjunction with ACTIVITY_QUERY_10 or ACTIVITY_QUERY_LT_10.
        Uses a dictionary to save the result for each instance
Use ACTIVITY_METRICS_LT_8_3 or ACTIVITY_METRICS_8_3 or ACTIVITY_METRICS_9_2 depending on the postgres version in conjunction with ACTIVITY_QUERY_10 or ACTIVITY_QUERY_LT_10 . Uses a dictionary to save the result for each instance
def get_activity_metrics(self, version):
        """Use ACTIVITY_METRICS_LT_8_3 or ACTIVITY_METRICS_8_3 or ACTIVITY_METRICS_9_2
        depending on the postgres version in conjunction with ACTIVITY_QUERY_10 or ACTIVITY_QUERY_LT_10.
        Uses a dictionary to save the result for each instance
        """
        metrics_data = self.activity_metrics

        if metrics_data is None:
            query = ACTIVITY_QUERY_10 if version >= V10 else ACTIVITY_QUERY_LT_10
            if version >= V9_6:
                metrics_query = ACTIVITY_METRICS_9_6
            elif version >= V9_2:
                metrics_query = ACTIVITY_METRICS_9_2
            elif version >= V8_3:
                metrics_query = ACTIVITY_METRICS_8_3
            else:
                metrics_query = ACTIVITY_METRICS_LT_8_3

            for i, q in enumerate(metrics_query):
                if '{dd__user}' in q:
                    metrics_query[i] = q.format(dd__user=self.config.user)

            metrics = {k: v for k, v in zip(metrics_query, ACTIVITY_DD_METRICS)}
            self.activity_metrics = (metrics, query)
        else:
            metrics, query = metrics_data

        return {'descriptors': [('datname', 'db')], 'metrics': metrics, 'query': query, 'relation': False}
def get_activity_metrics ( self , version ) : metrics_data = self . activity_metrics if metrics_data is None : query = ACTIVITY_QUERY_10 if version >= V10 else ACTIVITY_QUERY_LT_10 if version >= V9_6 : metrics_query = ACTIVITY_METRICS_9_6 elif version >= V9_2 : metrics_query = ACTIVITY_METRICS_9_2 elif version >= V8_3 : metrics_query = ACTIVITY_METRICS_8_3 else : metrics_query = ACTIVITY_METRICS_LT_8_3 for i , q in enumerate ( metrics_query ) : if '{dd__user}' in q : metrics_query [ i ] = q . format ( dd__user = self . config . user ) metrics = { k : v for k , v in zip ( metrics_query , ACTIVITY_DD_METRICS ) } self . activity_metrics = ( metrics , query ) else : metrics , query = metrics_data return { 'descriptors' : [ ( 'datname' , 'db' ) ] , 'metrics' : metrics , 'query' : query , 'relation' : False }