Exemple #1
0
 def test_list_metric_with_measures_to_process(self):
     metrics = tests_utils.list_all_incoming_metrics(self.incoming)
     self.assertEqual(set(), metrics)
     self.incoming.add_measures(self.metric, [
         storage.Measure(utils.dt_to_unix_ns(2014, 1, 1, 12, 0, 1), 69),
     ])
     metrics = tests_utils.list_all_incoming_metrics(self.incoming)
     self.assertEqual(set([str(self.metric.id)]), metrics)
     self.trigger_processing()
     metrics = tests_utils.list_all_incoming_metrics(self.incoming)
     self.assertEqual(set([]), metrics)
Exemple #2
0
 def test_list_metric_with_measures_to_process(self):
     metrics = tests_utils.list_all_incoming_metrics(self.incoming)
     self.assertEqual(set(), metrics)
     self.incoming.add_measures(self.metric.id, [
         incoming.Measure(datetime64(2014, 1, 1, 12, 0, 1), 69),
     ])
     metrics = tests_utils.list_all_incoming_metrics(self.incoming)
     self.assertEqual(set([str(self.metric.id)]), metrics)
     self.trigger_processing()
     metrics = tests_utils.list_all_incoming_metrics(self.incoming)
     self.assertEqual(set([]), metrics)
Exemple #3
0
 def run(self):
     while self.flag:
         metrics = utils.list_all_incoming_metrics(self.chef.incoming)
         metrics = self.chef.index.list_metrics(
             attribute_filter={"in": {
                 "id": metrics
             }})
         for metric in metrics:
             self.chef.refresh_metric(metric, timeout=None)
         time.sleep(0.1)
Exemple #4
0
 def run(self):
     while self.flag:
         metrics = utils.list_all_incoming_metrics(self.incoming)
         metrics = self.index.list_metrics(ids=metrics)
         for metric in metrics:
             self.storage.refresh_metric(self.index,
                                         self.incoming,
                                         metric,
                                         timeout=None)
         time.sleep(0.1)
    def _test_create_metric_and_data(self, data, spacing):
        metric = storage.Metric(uuid.uuid4(), self.archive_policies['medium'])
        start_time = utils.datetime_utc(2014, 1, 1, 12)
        incr = datetime.timedelta(seconds=spacing)
        measures = [
            storage.Measure(utils.dt_in_unix_ns(start_time + incr * n), val)
            for n, val in enumerate(data)
        ]
        self.index.create_metric(metric.id, str(uuid.uuid4()), 'medium')
        self.storage.incoming.add_measures(metric, measures)
        metrics = tests_utils.list_all_incoming_metrics(self.storage.incoming)
        self.storage.process_background_tasks(self.index, metrics, sync=True)

        return metric
Exemple #6
0
 def run(self):
     while self.flag:
         metrics = utils.list_all_incoming_metrics(self.storage.incoming)
         self.storage.process_background_tasks(self.index, metrics)
         time.sleep(0.1)