def increment(self, event, count, environment_id, timestamp=None): tsdb.incr( tsdb.models.group, event.group_id, count=count, environment_id=environment_id, timestamp=timestamp, )
def test_rate_reached(self, mock_now): mock_now.return_value = datetime(2016, 8, 1, 0, 0, 0, 0, tzinfo=timezone.utc) snooze = GroupSnooze.objects.create( group=self.group, count=100, window=60, ) tsdb.incr( tsdb.models.group, self.group.id, count=100, ) assert not snooze.is_valid(test_rates=True)
def test_rate_reached(self, mock_now): mock_now.return_value = datetime(2016, 8, 1, 0, 0, 0, 0, tzinfo=timezone.utc) snooze = GroupSnooze.objects.create( group=self.group, count=100, window=24 * 60, ) for n in range(6): tsdb.incr( tsdb.models.group, self.group.id, count=20, timestamp=mock_now() - timedelta(minutes=n), ) assert not snooze.is_valid(test_rates=True)
def increment(self, event, count, timestamp=None): tsdb.incr(tsdb.models.group, event.group_id, count=count, timestamp=timestamp)