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,
     )
示例#2
0
    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)
示例#3
0
    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)
示例#4
0
    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)