boundary/measurement_get.py
def output_csv(self, text):
        """
        Output results in CSV format
        """
        payload = json.loads(text)
        # Print CSV header
        print("{0},{1},{2},{3},{4}".format('timestamp', 'metric', 'aggregate', 'source', 'value'))
        metric_name = self._metric_name
        # Loop through the aggregates one row per timestamp, and 1 or more source/value pairs
        for r in payload['result']['aggregates']['key']:
            timestamp = self._format_timestamp(r[0][0])
            # timestamp = string.strip(timestamp, ' ')
            # timestamp = string.strip(timestamp, "'")
            for s in r[1]:
                print('{0},"{1}","{2}","{3}",{4}'.format(timestamp, metric_name, self.aggregate, s[0], s[1]))
def output_csv(self, text):
        payload = json.loads(text)
        # Print CSV header
        print("{0},{1},{2},{3},{4}".format('timestamp', 'metric', 'aggregate', 'source', 'value'))
        metric_name = self._metric_name
        # Loop through the aggregates one row per timestamp, and 1 or more source/value pairs
        for r in payload['result']['aggregates']['key']:
            timestamp = self._format_timestamp(r[0][0])
            # timestamp = string.strip(timestamp, ' ')
            # timestamp = string.strip(timestamp, "'")
            for s in r[1]:
                print('{0},"{1}","{2}","{3}",{4}'.format(timestamp, metric_name, self.aggregate, s[0], s[1]))
def output_csv ( self , text ) : payload = json . loads ( text ) # Print CSV header print ( "{0},{1},{2},{3},{4}" . format ( 'timestamp' , 'metric' , 'aggregate' , 'source' , 'value' ) ) metric_name = self . _metric_name # Loop through the aggregates one row per timestamp, and 1 or more source/value pairs for r in payload [ 'result' ] [ 'aggregates' ] [ 'key' ] : timestamp = self . _format_timestamp ( r [ 0 ] [ 0 ] ) # timestamp = string.strip(timestamp, ' ') # timestamp = string.strip(timestamp, "'") for s in r [ 1 ] : print ( '{0},"{1}","{2}","{3}",{4}' . format ( timestamp , metric_name , self . aggregate , s [ 0 ] , s [ 1 ] ) )
Output results in CSV format
Output results in CSV format