(self, version)
return {
            'descriptors': [],
            'metrics': self.bgw_metrics,
            'query': "select {metrics_columns} FROM pg_stat_bgwriter",
            'relation': False,
        }
Use either COMMON_BGW_METRICS or COMMON_BGW_METRICS + NEWER_92_BGW_METRICS
        depending on the postgres version.
        Uses a dictionary to save the result for each instance
Use either COMMON_BGW_METRICS or COMMON_BGW_METRICS + NEWER_92_BGW_METRICS
        depending on the postgres version.
        Uses a dictionary to save the result for each instance
Use either COMMON_BGW_METRICS or COMMON_BGW_METRICS + NEWER_92_BGW_METRICS depending on the postgres version . Uses a dictionary to save the result for each instance
def get_bgw_metrics(self, version):
        """Use either COMMON_BGW_METRICS or COMMON_BGW_METRICS + NEWER_92_BGW_METRICS
        depending on the postgres version.
        Uses a dictionary to save the result for each instance
        """
        # Extended 9.2+ metrics if needed
        if self.bgw_metrics is None:
            self.bgw_metrics = dict(COMMON_BGW_METRICS)

            if version >= V9_1:
                self.bgw_metrics.update(NEWER_91_BGW_METRICS)
            if version >= V9_2:
                self.bgw_metrics.update(NEWER_92_BGW_METRICS)

        if not self.bgw_metrics:
            return None

        return {
            'descriptors': [],
            'metrics': self.bgw_metrics,
            'query': "select {metrics_columns} FROM pg_stat_bgwriter",
            'relation': False,
        }
def get_bgw_metrics ( self , version ) : # Extended 9.2+ metrics if needed if self . bgw_metrics is None : self . bgw_metrics = dict ( COMMON_BGW_METRICS ) if version >= V9_1 : self . bgw_metrics . update ( NEWER_91_BGW_METRICS ) if version >= V9_2 : self . bgw_metrics . update ( NEWER_92_BGW_METRICS ) if not self . bgw_metrics : return None return { 'descriptors' : [ ] , 'metrics' : self . bgw_metrics , 'query' : "select {metrics_columns} FROM pg_stat_bgwriter" , 'relation' : False , }