示例#1
0
    def handle(self, *args, **options):
        with open(options['datafile'], 'r') as f:
            data = ujson.load(f)

        all_metrics = Collection.unserialize(data)

        query = Query().where_eq('id', 'browser.dom.event.interactive')

        result_set = query.execute(all_metrics)
        dump_result_set(result_set)
示例#2
0
    def handle(self, *args, **options):
        with open(options['datafile'], 'r') as f:
            data = ujson.load(f)

        all_metrics = Collection.unserialize(data)

        query = Query().where_eq('id', 'browser.dom.event.interactive')

        result_set = query.execute(all_metrics)
        dump_result_set(result_set)
    def handle(self, *args, **options):
        if options['datafile']:
            with open(options['datafile'], 'r') as f:
                data = ujson.load(f)
        elif options['resultid']:
            url = build_absolute_uri('/api/v1/results/{}/'.format(options['resultid']))
            response = requests.get(url)
            data = response.json()['results']
        else:
            raise RuntimeError('You need to specify either --resultid or --datafile')

        all_metrics = Collection.unserialize(data)

        basic_metric_set = BasicMetricSet(all_metrics)

        basic_metrics = basic_metric_set.items

        for k, v  in basic_metrics.items():
            print('METRIC: {}'.format(k))
            dump_stats(v)
示例#4
0
 def get_metrics(self):
     results = self.results.all()[0:1]
     if len(results) == 0:
         return None
     return Collection.unserialize(results[0].results)