boundary/measurement_get.py
def output_json(self, text):
        """
        Output results in structured JSON format
        """
        payload = json.loads(text)
        data = []
        metric_name = self._metric_name
        for r in payload['result']['aggregates']['key']:
            timestamp = self._format_timestamp(r[0][0])
            for s in r[1]:
                data.append({
                    "timestamp": timestamp,
                    "metric": metric_name,
                    "aggregate": self.aggregate,
                    "source": s[0],
                    "value": s[1],
                })
        payload = {"data": data}
        out = json.dumps(payload, indent=self._indent, separators=(',', ': '))
        print(self.colorize_json(out))
def output_json(self, text):
        """
        Output results in structured JSON format
        """
        payload = json.loads(text)
        data = []
        metric_name = self._metric_name
        for r in payload['result']['aggregates']['key']:
            timestamp = self._format_timestamp(r[0][0])
            for s in r[1]:
                data.append({
                    "timestamp": timestamp,
                    "metric": metric_name,
                    "aggregate": self.aggregate,
                    "source": s[0],
                    "value": s[1],
                })
        payload = {"data": data}
        out = json.dumps(payload, indent=self._indent, separators=(',', ': '))
        print(self.colorize_json(out))
def output_json ( self , text ) : payload = json . loads ( text ) data = [ ] metric_name = self . _metric_name for r in payload [ 'result' ] [ 'aggregates' ] [ 'key' ] : timestamp = self . _format_timestamp ( r [ 0 ] [ 0 ] ) for s in r [ 1 ] : data . append ( { "timestamp" : timestamp , "metric" : metric_name , "aggregate" : self . aggregate , "source" : s [ 0 ] , "value" : s [ 1 ] , } ) payload = { "data" : data } out = json . dumps ( payload , indent = self . _indent , separators = ( ',' , ': ' ) ) print ( self . colorize_json ( out ) )
Output results in structured JSON format
Output results in structured JSON format