test_event_frequency.py 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668
  1. import time
  2. from copy import deepcopy
  3. from datetime import timedelta
  4. from unittest.mock import patch
  5. from uuid import uuid4
  6. import pytest
  7. from django.utils import timezone
  8. from sentry.issues.grouptype import PerformanceNPlusOneGroupType
  9. from sentry.models.rule import Rule
  10. from sentry.rules.conditions.event_frequency import (
  11. EventFrequencyCondition,
  12. EventFrequencyPercentCondition,
  13. EventUniqueUserFrequencyCondition,
  14. )
  15. from sentry.testutils.abstract import Abstract
  16. from sentry.testutils.cases import (
  17. BaseMetricsTestCase,
  18. PerformanceIssueTestCase,
  19. RuleTestCase,
  20. SnubaTestCase,
  21. )
  22. from sentry.testutils.helpers.datetime import before_now, freeze_time, iso_format
  23. from sentry.testutils.skips import requires_snuba
  24. from sentry.utils.samples import load_data
  25. pytestmark = [pytest.mark.sentry_metrics, requires_snuba]
  26. class BaseEventFrequencyPercentTest(BaseMetricsTestCase):
  27. def _make_sessions(self, num: int, environment_name: str | None = None):
  28. received = time.time()
  29. def make_session(i):
  30. return dict(
  31. distinct_id=uuid4().hex,
  32. session_id=uuid4().hex,
  33. org_id=self.project.organization_id,
  34. project_id=self.project.id,
  35. status="ok",
  36. seq=0,
  37. release="foo@1.0.0",
  38. environment=environment_name if environment_name else "prod",
  39. retention_days=90,
  40. duration=None,
  41. errors=0,
  42. # The line below is crucial to spread sessions throughout the time period.
  43. started=received - i - 1,
  44. received=received,
  45. )
  46. self.bulk_store_sessions([make_session(i) for i in range(num)])
  47. class EventFrequencyQueryTestBase(SnubaTestCase, RuleTestCase, PerformanceIssueTestCase):
  48. def setUp(self):
  49. super().setUp()
  50. self.start = before_now(minutes=1)
  51. self.end = timezone.now()
  52. self.event = self.store_event(
  53. data={
  54. "event_id": "a" * 32,
  55. "environment": self.environment.name,
  56. "timestamp": iso_format(before_now(seconds=30)),
  57. "fingerprint": ["group-1"],
  58. "user": {"id": uuid4().hex},
  59. },
  60. project_id=self.project.id,
  61. )
  62. self.event2 = self.store_event(
  63. data={
  64. "event_id": "b" * 32,
  65. "environment": self.environment.name,
  66. "timestamp": iso_format(before_now(seconds=12)),
  67. "fingerprint": ["group-2"],
  68. "user": {"id": uuid4().hex},
  69. },
  70. project_id=self.project.id,
  71. )
  72. self.environment2 = self.create_environment(name="staging")
  73. self.event3 = self.store_event(
  74. data={
  75. "event_id": "c" * 32,
  76. "environment": self.environment2.name,
  77. "timestamp": iso_format(before_now(seconds=12)),
  78. "fingerprint": ["group-3"],
  79. "user": {"id": uuid4().hex},
  80. },
  81. project_id=self.project.id,
  82. )
  83. fingerprint = f"{PerformanceNPlusOneGroupType.type_id}-something_random"
  84. perf_event_data = load_data(
  85. "transaction-n-plus-one",
  86. timestamp=before_now(seconds=12),
  87. start_timestamp=before_now(seconds=13),
  88. fingerprint=[fingerprint],
  89. )
  90. perf_event_data["user"] = {"id": uuid4().hex}
  91. perf_event_data["environment"] = self.environment.name
  92. # Store a performance event
  93. self.perf_event = self.create_performance_issue(
  94. event_data=perf_event_data,
  95. project_id=self.project.id,
  96. fingerprint=fingerprint,
  97. )
  98. self.data = {"interval": "5m", "value": 30}
  99. self.condition_inst = self.get_rule(
  100. data=self.data,
  101. project=self.event.group.project,
  102. rule=Rule(environment_id=self.environment.id),
  103. )
  104. self.condition_inst2 = self.get_rule(
  105. data=self.data,
  106. project=self.event.group.project,
  107. rule=Rule(environment_id=self.environment2.id),
  108. )
  109. class EventFrequencyQueryTest(EventFrequencyQueryTestBase):
  110. rule_cls = EventFrequencyCondition
  111. def test_batch_query(self):
  112. batch_query = self.condition_inst.batch_query_hook(
  113. group_ids=[self.event.group_id, self.event2.group_id, self.perf_event.group_id],
  114. start=self.start,
  115. end=self.end,
  116. environment_id=self.environment.id,
  117. )
  118. assert batch_query == {
  119. self.event.group_id: 1,
  120. self.event2.group_id: 1,
  121. self.perf_event.group_id: 1,
  122. }
  123. batch_query = self.condition_inst2.batch_query_hook(
  124. group_ids=[self.event3.group_id],
  125. start=self.start,
  126. end=self.end,
  127. environment_id=self.environment2.id,
  128. )
  129. assert batch_query == {self.event3.group_id: 1}
  130. class EventUniqueUserFrequencyQueryTest(EventFrequencyQueryTestBase):
  131. rule_cls = EventUniqueUserFrequencyCondition
  132. def test_batch_query_user(self):
  133. batch_query = self.condition_inst.batch_query_hook(
  134. group_ids=[self.event.group_id, self.event2.group_id, self.perf_event.group_id],
  135. start=self.start,
  136. end=self.end,
  137. environment_id=self.environment.id,
  138. )
  139. assert batch_query == {
  140. self.event.group_id: 1,
  141. self.event2.group_id: 1,
  142. self.perf_event.group_id: 1,
  143. }
  144. batch_query = self.condition_inst2.batch_query_hook(
  145. group_ids=[self.event3.group_id],
  146. start=self.start,
  147. end=self.end,
  148. environment_id=self.environment2.id,
  149. )
  150. assert batch_query == {self.event3.group_id: 1}
  151. class EventFrequencyPercentConditionQueryTest(
  152. EventFrequencyQueryTestBase, BaseEventFrequencyPercentTest
  153. ):
  154. rule_cls = EventFrequencyPercentCondition
  155. @patch("sentry.rules.conditions.event_frequency.MIN_SESSIONS_TO_FIRE", 1)
  156. def test_batch_query_percent(self):
  157. self._make_sessions(60, self.environment2.name)
  158. self._make_sessions(60, self.environment.name)
  159. batch_query = self.condition_inst.batch_query_hook(
  160. group_ids=[self.event.group_id, self.event2.group_id, self.perf_event.group_id],
  161. start=self.start,
  162. end=self.end,
  163. environment_id=self.environment.id,
  164. )
  165. percent_of_sessions = 20
  166. assert batch_query == {
  167. self.event.group_id: percent_of_sessions,
  168. self.event2.group_id: percent_of_sessions,
  169. }
  170. batch_query = self.condition_inst2.batch_query_hook(
  171. group_ids=[self.event3.group_id],
  172. start=self.start,
  173. end=self.end,
  174. environment_id=self.environment2.id,
  175. )
  176. assert batch_query == {self.event3.group_id: percent_of_sessions}
  177. class ErrorEventMixin(SnubaTestCase):
  178. def add_event(self, data, project_id, timestamp):
  179. data["timestamp"] = iso_format(timestamp)
  180. # Store an error event
  181. event = self.store_event(
  182. data=data,
  183. project_id=project_id,
  184. )
  185. return event.for_group(event.group)
  186. class PerfIssuePlatformEventMixin(PerformanceIssueTestCase):
  187. def add_event(self, data, project_id, timestamp):
  188. fingerprint = data["fingerprint"][0]
  189. fingerprint = (
  190. fingerprint
  191. if "-" in fingerprint
  192. else f"{PerformanceNPlusOneGroupType.type_id}-{data['fingerprint'][0]}"
  193. )
  194. event_data = load_data(
  195. "transaction-n-plus-one",
  196. timestamp=timestamp,
  197. start_timestamp=timestamp,
  198. fingerprint=[fingerprint],
  199. )
  200. event_data["user"] = {"id": uuid4().hex}
  201. event_data["environment"] = data.get("environment")
  202. for tag in event_data["tags"]:
  203. if tag[0] == "environment":
  204. tag[1] = data.get("environment")
  205. break
  206. else:
  207. event_data["tags"].append(data.get("environment"))
  208. # Store a performance event
  209. event = self.create_performance_issue(
  210. event_data=event_data,
  211. project_id=project_id,
  212. fingerprint=fingerprint,
  213. )
  214. return event
  215. @pytest.mark.snuba_ci
  216. class StandardIntervalTestBase(SnubaTestCase, RuleTestCase, PerformanceIssueTestCase):
  217. __test__ = Abstract(__module__, __qualname__)
  218. def add_event(self, data, project_id, timestamp):
  219. raise NotImplementedError
  220. def increment(self, event, count, environment=None, timestamp=None):
  221. raise NotImplementedError
  222. def _run_test(self, minutes, data, passes, add_events=False):
  223. if not self.environment:
  224. self.environment = self.create_environment(name="prod")
  225. rule = self.get_rule(data=data, rule=Rule(environment_id=None))
  226. environment_rule = self.get_rule(data=data, rule=Rule(environment_id=self.environment.id))
  227. event = self.add_event(
  228. data={
  229. "fingerprint": ["something_random"],
  230. "user": {"id": uuid4().hex},
  231. },
  232. project_id=self.project.id,
  233. timestamp=before_now(minutes=minutes),
  234. )
  235. if add_events:
  236. self.increment(
  237. event,
  238. data["value"] + 1,
  239. environment=self.environment.name,
  240. timestamp=timezone.now() - timedelta(minutes=minutes),
  241. )
  242. self.increment(
  243. event,
  244. data["value"] + 1,
  245. timestamp=timezone.now() - timedelta(minutes=minutes),
  246. )
  247. if passes:
  248. self.assertPasses(rule, event, is_new=False)
  249. self.assertPasses(environment_rule, event, is_new=False)
  250. else:
  251. self.assertDoesNotPass(rule, event, is_new=False)
  252. self.assertDoesNotPass(environment_rule, event, is_new=False)
  253. def test_one_minute_with_events(self):
  254. data = {"interval": "1m", "value": 6}
  255. self._run_test(data=data, minutes=1, passes=True, add_events=True)
  256. data = {"interval": "1m", "value": 16}
  257. self._run_test(data=data, minutes=1, passes=False)
  258. def test_one_hour_with_events(self):
  259. data = {"interval": "1h", "value": 6}
  260. self._run_test(data=data, minutes=60, passes=True, add_events=True)
  261. data = {"interval": "1h", "value": 16}
  262. self._run_test(data=data, minutes=60, passes=False)
  263. def test_one_day_with_events(self):
  264. data = {"interval": "1d", "value": 6}
  265. self._run_test(data=data, minutes=1440, passes=True, add_events=True)
  266. data = {"interval": "1d", "value": 16}
  267. self._run_test(data=data, minutes=1440, passes=False)
  268. def test_one_week_with_events(self):
  269. data = {"interval": "1w", "value": 6}
  270. self._run_test(data=data, minutes=10080, passes=True, add_events=True)
  271. data = {"interval": "1w", "value": 16}
  272. self._run_test(data=data, minutes=10080, passes=False)
  273. def test_one_minute_no_events(self):
  274. data = {"interval": "1m", "value": 6}
  275. self._run_test(data=data, minutes=1, passes=False)
  276. def test_one_hour_no_events(self):
  277. data = {"interval": "1h", "value": 6}
  278. self._run_test(data=data, minutes=60, passes=False)
  279. def test_one_day_no_events(self):
  280. data = {"interval": "1d", "value": 6}
  281. self._run_test(data=data, minutes=1440, passes=False)
  282. def test_one_week_no_events(self):
  283. data = {"interval": "1w", "value": 6}
  284. self._run_test(data=data, minutes=10080, passes=False)
  285. def test_comparison(self):
  286. # Test data is 4 events in the current period and 2 events in the comparison period, so
  287. # a 100% increase.
  288. event = self.add_event(
  289. data={
  290. "fingerprint": ["something_random"],
  291. "user": {"id": uuid4().hex},
  292. },
  293. project_id=self.project.id,
  294. timestamp=before_now(minutes=1),
  295. )
  296. self.increment(
  297. event,
  298. 3,
  299. timestamp=timezone.now() - timedelta(minutes=1),
  300. )
  301. self.increment(
  302. event,
  303. 2,
  304. timestamp=timezone.now() - timedelta(days=1, minutes=20),
  305. )
  306. data = {
  307. "interval": "1h",
  308. "value": 99,
  309. "comparisonType": "percent",
  310. "comparisonInterval": "1d",
  311. }
  312. rule = self.get_rule(data=data, rule=Rule(environment_id=None))
  313. self.assertPasses(rule, event, is_new=False)
  314. data = {
  315. "interval": "1h",
  316. "value": 101,
  317. "comparisonType": "percent",
  318. "comparisonInterval": "1d",
  319. }
  320. rule = self.get_rule(data=data, rule=Rule(environment_id=None))
  321. self.assertDoesNotPass(rule, event, is_new=False)
  322. def test_comparison_empty_comparison_period(self):
  323. # Test data is 1 event in the current period and 0 events in the comparison period. This
  324. # should always result in 0 and never fire.
  325. event = self.add_event(
  326. data={
  327. "fingerprint": ["something_random"],
  328. "user": {"id": uuid4().hex},
  329. },
  330. project_id=self.project.id,
  331. timestamp=before_now(minutes=1),
  332. )
  333. data = {
  334. "interval": "1h",
  335. "value": 0,
  336. "comparisonType": "percent",
  337. "comparisonInterval": "1d",
  338. }
  339. rule = self.get_rule(data=data, rule=Rule(environment_id=None))
  340. self.assertDoesNotPass(rule, event, is_new=False)
  341. data = {
  342. "interval": "1h",
  343. "value": 100,
  344. "comparisonType": "percent",
  345. "comparisonInterval": "1d",
  346. }
  347. rule = self.get_rule(data=data, rule=Rule(environment_id=None))
  348. self.assertDoesNotPass(rule, event, is_new=False)
  349. @patch("sentry.rules.conditions.event_frequency.BaseEventFrequencyCondition.get_rate")
  350. def test_is_new_issue_skips_snuba(self, mock_get_rate):
  351. # Looking for more than 1 event
  352. data = {"interval": "1m", "value": 6}
  353. minutes = 1
  354. rule = self.get_rule(data=data, rule=Rule(environment_id=None))
  355. environment_rule = self.get_rule(data=data, rule=Rule(environment_id=self.environment.id))
  356. event = self.add_event(
  357. data={
  358. "fingerprint": ["something_random"],
  359. "user": {"id": uuid4().hex},
  360. },
  361. project_id=self.project.id,
  362. timestamp=before_now(minutes=minutes),
  363. )
  364. # Issue is new and is the first event
  365. self.assertDoesNotPass(rule, event, is_new=True)
  366. self.assertDoesNotPass(environment_rule, event, is_new=True)
  367. assert mock_get_rate.call_count == 0
  368. class EventFrequencyConditionTestCase(StandardIntervalTestBase):
  369. __test__ = Abstract(__module__, __qualname__)
  370. rule_cls = EventFrequencyCondition
  371. def increment(self, event, count, environment=None, timestamp=None):
  372. timestamp = timestamp if timestamp else before_now(minutes=1)
  373. data = {"fingerprint": event.data["fingerprint"]}
  374. if environment:
  375. data["environment"] = environment
  376. for _ in range(count):
  377. self.add_event(
  378. data=data,
  379. project_id=self.project.id,
  380. timestamp=timestamp,
  381. )
  382. class EventUniqueUserFrequencyConditionTestCase(StandardIntervalTestBase):
  383. __test__ = Abstract(__module__, __qualname__)
  384. rule_cls = EventUniqueUserFrequencyCondition
  385. def increment(self, event, count, environment=None, timestamp=None):
  386. timestamp = timestamp if timestamp else before_now(minutes=1)
  387. data = {"fingerprint": event.data["fingerprint"]}
  388. if environment:
  389. data["environment"] = environment
  390. for _ in range(count):
  391. event_data = deepcopy(data)
  392. event_data["user"] = {"id": uuid4().hex}
  393. self.add_event(
  394. data=event_data,
  395. project_id=self.project.id,
  396. timestamp=timestamp,
  397. )
  398. class EventFrequencyPercentConditionTestCase(BaseEventFrequencyPercentTest, RuleTestCase):
  399. __test__ = Abstract(__module__, __qualname__)
  400. rule_cls = EventFrequencyPercentCondition
  401. def add_event(self, data, project_id, timestamp):
  402. raise NotImplementedError
  403. def _run_test(self, minutes, data, passes, add_events=False):
  404. if not self.environment or self.environment.name != "prod":
  405. self.environment = self.create_environment(name="prod")
  406. if not hasattr(self, "test_event"):
  407. self.test_event = self.add_event(
  408. data={
  409. "fingerprint": ["something_random"],
  410. "user": {"id": uuid4().hex},
  411. "environment": self.environment.name,
  412. },
  413. project_id=self.project.id,
  414. timestamp=before_now(minutes=minutes),
  415. )
  416. if add_events:
  417. self.increment(
  418. self.test_event,
  419. max(1, int(minutes / 2)) - 1,
  420. environment=self.environment.name,
  421. timestamp=timezone.now() - timedelta(minutes=minutes),
  422. )
  423. rule = self.get_rule(data=data, rule=Rule(environment_id=None))
  424. environment_rule = self.get_rule(data=data, rule=Rule(environment_id=self.environment.id))
  425. if passes:
  426. self.assertPasses(rule, self.test_event, is_new=False)
  427. self.assertPasses(environment_rule, self.test_event, is_new=False)
  428. else:
  429. self.assertDoesNotPass(rule, self.test_event)
  430. self.assertDoesNotPass(environment_rule, self.test_event)
  431. def increment(self, event, count, environment=None, timestamp=None):
  432. data = {
  433. "fingerprint": event.data["fingerprint"],
  434. }
  435. timestamp = timestamp if timestamp else before_now(minutes=1)
  436. if environment:
  437. data["environment"] = environment
  438. for _ in range(count):
  439. event_data = deepcopy(data)
  440. event_data["user"] = {"id": uuid4().hex}
  441. self.add_event(
  442. data=event_data,
  443. project_id=self.project.id,
  444. timestamp=timestamp,
  445. )
  446. @patch("sentry.rules.conditions.event_frequency.MIN_SESSIONS_TO_FIRE", 1)
  447. def test_five_minutes_with_events(self):
  448. self._make_sessions(60)
  449. data = {"interval": "5m", "value": 39}
  450. self._run_test(data=data, minutes=5, passes=True, add_events=True)
  451. data = {"interval": "5m", "value": 41}
  452. self._run_test(data=data, minutes=5, passes=False)
  453. @patch("sentry.rules.conditions.event_frequency.MIN_SESSIONS_TO_FIRE", 1)
  454. def test_ten_minutes_with_events(self):
  455. self._make_sessions(60)
  456. data = {"interval": "10m", "value": 49}
  457. self._run_test(data=data, minutes=10, passes=True, add_events=True)
  458. data = {"interval": "10m", "value": 51}
  459. self._run_test(data=data, minutes=10, passes=False)
  460. @patch("sentry.rules.conditions.event_frequency.MIN_SESSIONS_TO_FIRE", 1)
  461. def test_thirty_minutes_with_events(self):
  462. self._make_sessions(60)
  463. data = {"interval": "30m", "value": 49}
  464. self._run_test(data=data, minutes=30, passes=True, add_events=True)
  465. data = {"interval": "30m", "value": 51}
  466. self._run_test(data=data, minutes=30, passes=False)
  467. @patch("sentry.rules.conditions.event_frequency.MIN_SESSIONS_TO_FIRE", 1)
  468. def test_one_hour_with_events(self):
  469. self._make_sessions(60)
  470. data = {"interval": "1h", "value": 49}
  471. self._run_test(data=data, minutes=60, add_events=True, passes=True)
  472. data = {"interval": "1h", "value": 51}
  473. self._run_test(data=data, minutes=60, passes=False)
  474. @patch("sentry.rules.conditions.event_frequency.MIN_SESSIONS_TO_FIRE", 1)
  475. def test_five_minutes_no_events(self):
  476. self._make_sessions(60)
  477. data = {"interval": "5m", "value": 39}
  478. self._run_test(data=data, minutes=5, passes=True, add_events=True)
  479. @patch("sentry.rules.conditions.event_frequency.MIN_SESSIONS_TO_FIRE", 1)
  480. def test_ten_minutes_no_events(self):
  481. self._make_sessions(60)
  482. data = {"interval": "10m", "value": 49}
  483. self._run_test(data=data, minutes=10, passes=True, add_events=True)
  484. @patch("sentry.rules.conditions.event_frequency.MIN_SESSIONS_TO_FIRE", 1)
  485. def test_thirty_minutes_no_events(self):
  486. self._make_sessions(60)
  487. data = {"interval": "30m", "value": 49}
  488. self._run_test(data=data, minutes=30, passes=True, add_events=True)
  489. @patch("sentry.rules.conditions.event_frequency.MIN_SESSIONS_TO_FIRE", 1)
  490. def test_one_hour_no_events(self):
  491. self._make_sessions(60)
  492. data = {"interval": "1h", "value": 49}
  493. self._run_test(data=data, minutes=60, passes=False)
  494. @patch("sentry.rules.conditions.event_frequency.MIN_SESSIONS_TO_FIRE", 1)
  495. def test_comparison(self):
  496. self._make_sessions(10)
  497. # Create sessions for previous period
  498. self._make_sessions(10)
  499. # Test data is 2 events in the current period and 1 events in the comparison period.
  500. # Number of sessions is 20 in each period, so current period is 20% of sessions, prev
  501. # is 10%. Overall a 100% increase comparatively.
  502. event = self.add_event(
  503. data={"fingerprint": ["something_random"]},
  504. project_id=self.project.id,
  505. timestamp=before_now(minutes=1),
  506. )
  507. self.increment(
  508. event,
  509. 1,
  510. timestamp=timezone.now() - timedelta(minutes=1),
  511. )
  512. self.increment(
  513. event,
  514. 1,
  515. timestamp=timezone.now() - timedelta(days=1, minutes=20),
  516. )
  517. data = {
  518. "interval": "1h",
  519. "value": 99,
  520. "comparisonType": "percent",
  521. "comparisonInterval": "1d",
  522. }
  523. rule = self.get_rule(data=data, rule=Rule(environment_id=None))
  524. self.assertPasses(rule, event, is_new=False)
  525. data = {
  526. "interval": "1h",
  527. "value": 101,
  528. "comparisonType": "percent",
  529. "comparisonInterval": "1d",
  530. }
  531. rule = self.get_rule(data=data, rule=Rule(environment_id=None))
  532. self.assertDoesNotPass(rule, event, is_new=False)
  533. @freeze_time(
  534. (timezone.now() - timedelta(days=2)).replace(hour=12, minute=40, second=0, microsecond=0)
  535. )
  536. class ErrorIssueFrequencyConditionTestCase(ErrorEventMixin, EventFrequencyConditionTestCase):
  537. pass
  538. @freeze_time(
  539. (timezone.now() - timedelta(days=2)).replace(hour=12, minute=40, second=0, microsecond=0)
  540. )
  541. class PerfIssuePlatformIssueFrequencyConditionTestCase(
  542. PerfIssuePlatformEventMixin,
  543. EventFrequencyConditionTestCase,
  544. ):
  545. pass
  546. @freeze_time(
  547. (timezone.now() - timedelta(days=2)).replace(hour=12, minute=40, second=0, microsecond=0)
  548. )
  549. class ErrorIssueUniqueUserFrequencyConditionTestCase(
  550. ErrorEventMixin,
  551. EventUniqueUserFrequencyConditionTestCase,
  552. ):
  553. pass
  554. @freeze_time(
  555. (timezone.now() - timedelta(days=2)).replace(hour=12, minute=40, second=0, microsecond=0)
  556. )
  557. class PerfIssuePlatformIssueUniqueUserFrequencyConditionTestCase(
  558. PerfIssuePlatformEventMixin,
  559. EventUniqueUserFrequencyConditionTestCase,
  560. ):
  561. pass
  562. @freeze_time(
  563. (timezone.now() - timedelta(days=2)).replace(hour=12, minute=40, second=0, microsecond=0)
  564. )
  565. class ErrorIssueEventFrequencyPercentConditionTestCase(
  566. ErrorEventMixin, EventFrequencyPercentConditionTestCase
  567. ):
  568. pass
  569. @freeze_time(
  570. (timezone.now() - timedelta(days=2)).replace(hour=12, minute=40, second=0, microsecond=0)
  571. )
  572. class PerfIssuePlatformIssueEventFrequencyPercentConditionTestCase(
  573. PerfIssuePlatformEventMixin,
  574. EventFrequencyPercentConditionTestCase,
  575. ):
  576. pass