(self)
XDR metrics are available from the get-stats command as of Aerospike 5.0.0

        https://www.aerospike.com/docs/reference/info/#get-stats
XDR metrics are available from the get-stats command as of Aerospike 5.0.0
XDR metrics are available from the get - stats command as of Aerospike 5 . 0 . 0
def collect_xdr(self):
        """
        XDR metrics are available from the get-stats command as of Aerospike 5.0.0

        https://www.aerospike.com/docs/reference/info/#get-stats
        """
        if self._required_datacenters:
            for dc in self._required_datacenters:
                data = self.get_info('get-stats:context=xdr;dc={}'.format(dc), separator=None)
                if not data:
                    self.log.debug("Got invalid data for dc %s", dc)
                    continue
                self.log.debug("Got data for dc `%s`: %s", dc, data)
                parsed_data = data.split("\n")
                tags = ['datacenter:{}'.format(dc)]
                for line in parsed_data:
                    line = line.strip()
                    if line:
                        if line.startswith('ERROR:'):
                            self.log.debug("Error collecting XDR metrics: %s", data)
                            continue

                        if 'returned' in line:
                            # Parse remote dc host and port from
                            # `ip-10-10-17-247.ec2.internal:3000 (10.10.17.247) returned:`
                            remote_dc = line.split(" (")[0].split(":")
                            tags.extend(
                                [
                                    'remote_dc_host:{}'.format(remote_dc[0]),
                                    'remote_dc_port:{}'.format(remote_dc[1]),
                                ]
                            )
                        else:
                            # Parse metrics from
                            # lag=0;in_queue=0;in_progress=0;success=98344698;abandoned=0;not_found=0;filtered_out=0;...
                            xdr_metrics = line.split(';')
                            self.log.debug("For dc host tags %s, got: %s", tags, xdr_metrics)
                            for item in xdr_metrics:
                                metric = item.split('=')
                                key = metric[0]
                                value = metric[1]
                                self.send(XDR_DATACENTER_METRIC_TYPE, key, value, tags)
                            # Reset dc tag
                            tags = ['datacenter:{}'.format(dc)]
        else:
            self.log.debug("No datacenters were specified to collect XDR metrics: %s", self._required_datacenters)
def collect_xdr ( self ) : if self . _required_datacenters : for dc in self . _required_datacenters : data = self . get_info ( 'get-stats:context=xdr;dc={}' . format ( dc ) , separator = None ) if not data : self . log . debug ( "Got invalid data for dc %s" , dc ) continue self . log . debug ( "Got data for dc `%s`: %s" , dc , data ) parsed_data = data . split ( "\n" ) tags = [ 'datacenter:{}' . format ( dc ) ] for line in parsed_data : line = line . strip ( ) if line : if line . startswith ( 'ERROR:' ) : self . log . debug ( "Error collecting XDR metrics: %s" , data ) continue if 'returned' in line : # Parse remote dc host and port from # `ip-10-10-17-247.ec2.internal:3000 (10.10.17.247) returned:` remote_dc = line . split ( " (" ) [ 0 ] . split ( ":" ) tags . extend ( [ 'remote_dc_host:{}' . format ( remote_dc [ 0 ] ) , 'remote_dc_port:{}' . format ( remote_dc [ 1 ] ) , ] ) else : # Parse metrics from # lag=0;in_queue=0;in_progress=0;success=98344698;abandoned=0;not_found=0;filtered_out=0;... xdr_metrics = line . split ( ';' ) self . log . debug ( "For dc host tags %s, got: %s" , tags , xdr_metrics ) for item in xdr_metrics : metric = item . split ( '=' ) key = metric [ 0 ] value = metric [ 1 ] self . send ( XDR_DATACENTER_METRIC_TYPE , key , value , tags ) # Reset dc tag tags = [ 'datacenter:{}' . format ( dc ) ] else : self . log . debug ( "No datacenters were specified to collect XDR metrics: %s" , self . _required_datacenters )