Esempio n. 1
0
	def _run_for_metric(self, metric_id, ts_rotation, is_hot):
		if self._is_rollup_processed(metric_id, ts_rotation):
			return

		params = [metric_id, ts_rotation, ValueSequence(_get_all_shards(self._shard_from, self._shard_to))]
		values = self._CounterBase.session.execute(self._read_stmt, params)

		self._save_metric_rollup(metric_id, ts_rotation, values, is_hot)
Esempio n. 2
0
    def test_get_all_shards(self):
        num_shards = 128

        shards = _get_all_shards(0, num_shards)

        self.assertEqual(shards[0], 0)
        self.assertEqual(shards[-1], 127)
        self.assertEqual(len(shards), 128)
Esempio n. 3
0
	def _run_for_metric(self, metric_id, ts_from, is_hot):
		if self._is_rollup_processed(metric_id, ts_from):
			return

		ts_to = ts_from + datetime.timedelta(seconds=self._rollup_out)

		values = []

		for ts in _get_all_rotations(ts_from, ts_to, self._rollup_in):
			params = [metric_id, ts, ValueSequence(_get_all_shards(self._shard_from, self._shard_to))]
			values += self._CounterBase.session.execute(self._read_stmt, params)

		self._save_metric_rollup(metric_id, ts_from, values, is_hot)