From 50baa6ef56b800d0392fe517c5f623b3a46c5f0f Mon Sep 17 00:00:00 2001 From: Li Yi Yu Date: Thu, 16 Nov 2023 17:58:47 -0500 Subject: [PATCH 1/4] do not double charge for survey sent events --- .../test/__snapshots__/test_usage_report.ambr | 2 ++ posthog/tasks/test/test_usage_report.py | 22 +++++++++++++++++++ posthog/tasks/usage_report.py | 2 +- 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/posthog/tasks/test/__snapshots__/test_usage_report.ambr b/posthog/tasks/test/__snapshots__/test_usage_report.ambr index 92f4167485468..7e1eb9c5fb2bf 100644 --- a/posthog/tasks/test/__snapshots__/test_usage_report.ambr +++ b/posthog/tasks/test/__snapshots__/test_usage_report.ambr @@ -15,6 +15,7 @@ FROM events WHERE timestamp between '2022-01-10 00:00:00' AND '2022-01-10 23:59:59' AND event != '$feature_flag_called' + AND event != 'survey sent' GROUP BY team_id ' --- @@ -196,6 +197,7 @@ FROM events WHERE timestamp between '2022-01-01 00:00:00' AND '2022-01-10 23:59:59' AND event != '$feature_flag_called' + AND event != 'survey sent' GROUP BY team_id ' --- diff --git a/posthog/tasks/test/test_usage_report.py b/posthog/tasks/test/test_usage_report.py index 79a7ab46b8ab2..53733d684d0a1 100644 --- a/posthog/tasks/test/test_usage_report.py +++ b/posthog/tasks/test/test_usage_report.py @@ -165,6 +165,14 @@ def _create_sample_usage_data(self) -> None: team=self.org_1_team_1, ) + _create_event( + distinct_id=distinct_id, + event="survey sent", + properties={"$survey_response": "cooool"}, + timestamp=now() - relativedelta(hours=12), + team=self.org_1_team_1, + ) + # Events before the period for _ in range(0, 10): _create_event( @@ -291,6 +299,13 @@ def _create_sample_usage_data(self) -> None: timestamp=now() - relativedelta(hours=12), team=self.org_1_team_2, ) + _create_event( + distinct_id=distinct_id, + event="survey sent", + properties={"$survey_response": "cooool"}, + timestamp=now() - relativedelta(hours=12), + team=self.org_1_team_2, + ) # Events for org 2 team 3 distinct_id = str(uuid4()) @@ -311,6 +326,13 @@ def _create_sample_usage_data(self) -> None: timestamp=now() - relativedelta(hours=12), team=self.org_2_team_3, ) + _create_event( + distinct_id=distinct_id, + event="survey sent", + properties={"$survey_response": "cooool"}, + timestamp=now() - relativedelta(hours=12), + team=self.org_2_team_3, + ) flush_persons_and_events() diff --git a/posthog/tasks/usage_report.py b/posthog/tasks/usage_report.py index 9ffbc39227331..e434d25ff298e 100644 --- a/posthog/tasks/usage_report.py +++ b/posthog/tasks/usage_report.py @@ -393,7 +393,7 @@ def get_teams_with_billable_event_count_in_period( f""" SELECT team_id, count({distinct_expression}) as count FROM events - WHERE timestamp between %(begin)s AND %(end)s AND event != '$feature_flag_called' + WHERE timestamp between %(begin)s AND %(end)s AND event != '$feature_flag_called' AND event != 'survey sent' GROUP BY team_id """, {"begin": begin, "end": end}, From 8739e6c4253e5e087beac3956b7ac276d540d2c5 Mon Sep 17 00:00:00 2001 From: Li Yi Yu Date: Thu, 16 Nov 2023 19:30:38 -0500 Subject: [PATCH 2/4] fix events and test --- .../test/__snapshots__/test_usage_report.ambr | 368 ------------------ posthog/tasks/test/test_usage_report.py | 63 +-- posthog/tasks/usage_report.py | 2 +- 3 files changed, 42 insertions(+), 391 deletions(-) delete mode 100644 posthog/tasks/test/__snapshots__/test_usage_report.ambr diff --git a/posthog/tasks/test/__snapshots__/test_usage_report.ambr b/posthog/tasks/test/__snapshots__/test_usage_report.ambr deleted file mode 100644 index 7e1eb9c5fb2bf..0000000000000 --- a/posthog/tasks/test/__snapshots__/test_usage_report.ambr +++ /dev/null @@ -1,368 +0,0 @@ -# name: TestFeatureFlagsUsageReport.test_usage_report_decide_requests - ' - - SELECT team_id, - count(1) as count - FROM events - GROUP BY team_id - ' ---- -# name: TestFeatureFlagsUsageReport.test_usage_report_decide_requests.1 - ' - - SELECT team_id, - count(distinct toDate(timestamp), event, cityHash64(distinct_id), cityHash64(uuid)) as count - FROM events - WHERE timestamp between '2022-01-10 00:00:00' AND '2022-01-10 23:59:59' - AND event != '$feature_flag_called' - AND event != 'survey sent' - GROUP BY team_id - ' ---- -# name: TestFeatureFlagsUsageReport.test_usage_report_decide_requests.10 - ' - WITH JSONExtractInt(log_comment, 'team_id') as team_id, - JSONExtractString(log_comment, 'query_type') as query_type, - JSONExtractString(log_comment, 'access_method') as access_method - SELECT team_id, - sum(read_bytes) as count - FROM clusterAllReplicas(posthog, system.query_log) - WHERE (type = 'QueryFinish' - OR type = 'ExceptionWhileProcessing') - AND is_initial_query = 1 - AND query_type IN (['hogql_query', 'HogQLQuery']) - AND query_start_time between '2022-01-10 00:00:00' AND '2022-01-10 23:59:59' - AND access_method = '' - GROUP BY team_id - ' ---- -# name: TestFeatureFlagsUsageReport.test_usage_report_decide_requests.11 - ' - WITH JSONExtractInt(log_comment, 'team_id') as team_id, - JSONExtractString(log_comment, 'query_type') as query_type, - JSONExtractString(log_comment, 'access_method') as access_method - SELECT team_id, - sum(read_rows) as count - FROM clusterAllReplicas(posthog, system.query_log) - WHERE (type = 'QueryFinish' - OR type = 'ExceptionWhileProcessing') - AND is_initial_query = 1 - AND query_type IN (['hogql_query', 'HogQLQuery']) - AND query_start_time between '2022-01-10 00:00:00' AND '2022-01-10 23:59:59' - AND access_method = '' - GROUP BY team_id - ' ---- -# name: TestFeatureFlagsUsageReport.test_usage_report_decide_requests.12 - ' - WITH JSONExtractInt(log_comment, 'team_id') as team_id, - JSONExtractString(log_comment, 'query_type') as query_type, - JSONExtractString(log_comment, 'access_method') as access_method - SELECT team_id, - sum(query_duration_ms) as count - FROM clusterAllReplicas(posthog, system.query_log) - WHERE (type = 'QueryFinish' - OR type = 'ExceptionWhileProcessing') - AND is_initial_query = 1 - AND query_type IN (['hogql_query', 'HogQLQuery']) - AND query_start_time between '2022-01-10 00:00:00' AND '2022-01-10 23:59:59' - AND access_method = '' - GROUP BY team_id - ' ---- -# name: TestFeatureFlagsUsageReport.test_usage_report_decide_requests.13 - ' - WITH JSONExtractInt(log_comment, 'team_id') as team_id, - JSONExtractString(log_comment, 'query_type') as query_type, - JSONExtractString(log_comment, 'access_method') as access_method - SELECT team_id, - sum(read_bytes) as count - FROM clusterAllReplicas(posthog, system.query_log) - WHERE (type = 'QueryFinish' - OR type = 'ExceptionWhileProcessing') - AND is_initial_query = 1 - AND query_type IN (['hogql_query', 'HogQLQuery']) - AND query_start_time between '2022-01-10 00:00:00' AND '2022-01-10 23:59:59' - AND access_method = 'personal_api_key' - GROUP BY team_id - ' ---- -# name: TestFeatureFlagsUsageReport.test_usage_report_decide_requests.14 - ' - WITH JSONExtractInt(log_comment, 'team_id') as team_id, - JSONExtractString(log_comment, 'query_type') as query_type, - JSONExtractString(log_comment, 'access_method') as access_method - SELECT team_id, - sum(read_rows) as count - FROM clusterAllReplicas(posthog, system.query_log) - WHERE (type = 'QueryFinish' - OR type = 'ExceptionWhileProcessing') - AND is_initial_query = 1 - AND query_type IN (['hogql_query', 'HogQLQuery']) - AND query_start_time between '2022-01-10 00:00:00' AND '2022-01-10 23:59:59' - AND access_method = 'personal_api_key' - GROUP BY team_id - ' ---- -# name: TestFeatureFlagsUsageReport.test_usage_report_decide_requests.15 - ' - WITH JSONExtractInt(log_comment, 'team_id') as team_id, - JSONExtractString(log_comment, 'query_type') as query_type, - JSONExtractString(log_comment, 'access_method') as access_method - SELECT team_id, - sum(query_duration_ms) as count - FROM clusterAllReplicas(posthog, system.query_log) - WHERE (type = 'QueryFinish' - OR type = 'ExceptionWhileProcessing') - AND is_initial_query = 1 - AND query_type IN (['hogql_query', 'HogQLQuery']) - AND query_start_time between '2022-01-10 00:00:00' AND '2022-01-10 23:59:59' - AND access_method = 'personal_api_key' - GROUP BY team_id - ' ---- -# name: TestFeatureFlagsUsageReport.test_usage_report_decide_requests.16 - ' - WITH JSONExtractInt(log_comment, 'team_id') as team_id, - JSONExtractString(log_comment, 'query_type') as query_type, - JSONExtractString(log_comment, 'access_method') as access_method - SELECT team_id, - sum(read_bytes) as count - FROM clusterAllReplicas(posthog, system.query_log) - WHERE (type = 'QueryFinish' - OR type = 'ExceptionWhileProcessing') - AND is_initial_query = 1 - AND query_type IN (['EventsQuery']) - AND query_start_time between '2022-01-10 00:00:00' AND '2022-01-10 23:59:59' - AND access_method = '' - GROUP BY team_id - ' ---- -# name: TestFeatureFlagsUsageReport.test_usage_report_decide_requests.17 - ' - WITH JSONExtractInt(log_comment, 'team_id') as team_id, - JSONExtractString(log_comment, 'query_type') as query_type, - JSONExtractString(log_comment, 'access_method') as access_method - SELECT team_id, - sum(read_rows) as count - FROM clusterAllReplicas(posthog, system.query_log) - WHERE (type = 'QueryFinish' - OR type = 'ExceptionWhileProcessing') - AND is_initial_query = 1 - AND query_type IN (['EventsQuery']) - AND query_start_time between '2022-01-10 00:00:00' AND '2022-01-10 23:59:59' - AND access_method = '' - GROUP BY team_id - ' ---- -# name: TestFeatureFlagsUsageReport.test_usage_report_decide_requests.18 - ' - WITH JSONExtractInt(log_comment, 'team_id') as team_id, - JSONExtractString(log_comment, 'query_type') as query_type, - JSONExtractString(log_comment, 'access_method') as access_method - SELECT team_id, - sum(query_duration_ms) as count - FROM clusterAllReplicas(posthog, system.query_log) - WHERE (type = 'QueryFinish' - OR type = 'ExceptionWhileProcessing') - AND is_initial_query = 1 - AND query_type IN (['EventsQuery']) - AND query_start_time between '2022-01-10 00:00:00' AND '2022-01-10 23:59:59' - AND access_method = '' - GROUP BY team_id - ' ---- -# name: TestFeatureFlagsUsageReport.test_usage_report_decide_requests.19 - ' - WITH JSONExtractInt(log_comment, 'team_id') as team_id, - JSONExtractString(log_comment, 'query_type') as query_type, - JSONExtractString(log_comment, 'access_method') as access_method - SELECT team_id, - sum(read_bytes) as count - FROM clusterAllReplicas(posthog, system.query_log) - WHERE (type = 'QueryFinish' - OR type = 'ExceptionWhileProcessing') - AND is_initial_query = 1 - AND query_type IN (['EventsQuery']) - AND query_start_time between '2022-01-10 00:00:00' AND '2022-01-10 23:59:59' - AND access_method = 'personal_api_key' - GROUP BY team_id - ' ---- -# name: TestFeatureFlagsUsageReport.test_usage_report_decide_requests.2 - ' - - SELECT team_id, - count(1) as count - FROM events - WHERE timestamp between '2022-01-01 00:00:00' AND '2022-01-10 23:59:59' - AND event != '$feature_flag_called' - AND event != 'survey sent' - GROUP BY team_id - ' ---- -# name: TestFeatureFlagsUsageReport.test_usage_report_decide_requests.20 - ' - WITH JSONExtractInt(log_comment, 'team_id') as team_id, - JSONExtractString(log_comment, 'query_type') as query_type, - JSONExtractString(log_comment, 'access_method') as access_method - SELECT team_id, - sum(read_rows) as count - FROM clusterAllReplicas(posthog, system.query_log) - WHERE (type = 'QueryFinish' - OR type = 'ExceptionWhileProcessing') - AND is_initial_query = 1 - AND query_type IN (['EventsQuery']) - AND query_start_time between '2022-01-10 00:00:00' AND '2022-01-10 23:59:59' - AND access_method = 'personal_api_key' - GROUP BY team_id - ' ---- -# name: TestFeatureFlagsUsageReport.test_usage_report_decide_requests.21 - ' - WITH JSONExtractInt(log_comment, 'team_id') as team_id, - JSONExtractString(log_comment, 'query_type') as query_type, - JSONExtractString(log_comment, 'access_method') as access_method - SELECT team_id, - sum(query_duration_ms) as count - FROM clusterAllReplicas(posthog, system.query_log) - WHERE (type = 'QueryFinish' - OR type = 'ExceptionWhileProcessing') - AND is_initial_query = 1 - AND query_type IN (['EventsQuery']) - AND query_start_time between '2022-01-10 00:00:00' AND '2022-01-10 23:59:59' - AND access_method = 'personal_api_key' - GROUP BY team_id - ' ---- -# name: TestFeatureFlagsUsageReport.test_usage_report_decide_requests.22 - ' - - SELECT team_id, - COUNT() as count - FROM events - WHERE event = 'survey sent' - AND timestamp between '2022-01-10 00:00:00' AND '2022-01-10 23:59:59' - GROUP BY team_id - ' ---- -# name: TestFeatureFlagsUsageReport.test_usage_report_decide_requests.23 - ' - - SELECT team_id, - COUNT() as count - FROM events - WHERE event = 'survey sent' - AND timestamp between '2022-01-01 00:00:00' AND '2022-01-10 23:59:59' - GROUP BY team_id - ' ---- -# name: TestFeatureFlagsUsageReport.test_usage_report_decide_requests.24 - ' - - SELECT team, - sum(rows_synced) - FROM - (SELECT JSONExtractString(properties, 'job_id') AS job_id, - distinct_id AS team, - any(JSONExtractInt(properties, 'count')) AS rows_synced - FROM events - WHERE team_id = 2 - AND event = 'external data sync job' - AND parseDateTimeBestEffort(JSONExtractString(properties, 'start_time')) BETWEEN '2022-01-10 00:00:00' AND '2022-01-10 23:59:59' - GROUP BY job_id, - team) - GROUP BY team - ' ---- -# name: TestFeatureFlagsUsageReport.test_usage_report_decide_requests.3 - ' - - SELECT team_id, - count(1) as count - FROM events - WHERE timestamp between '2022-01-10 00:00:00' AND '2022-01-10 23:59:59' - AND ($group_0 != '' - OR $group_1 != '' - OR $group_2 != '' - OR $group_3 != '' - OR $group_4 != '') - GROUP BY team_id - ' ---- -# name: TestFeatureFlagsUsageReport.test_usage_report_decide_requests.4 - ' - - SELECT team_id, - count(distinct session_id) as count - FROM session_replay_events - WHERE min_first_timestamp BETWEEN '2022-01-10 00:00:00' AND '2022-01-10 23:59:59' - AND session_id NOT IN - (SELECT DISTINCT session_id - FROM session_replay_events - WHERE min_first_timestamp BETWEEN '2022-01-09 00:00:00' AND '2022-01-10 00:00:00' - GROUP BY session_id) - GROUP BY team_id - ' ---- -# name: TestFeatureFlagsUsageReport.test_usage_report_decide_requests.5 - ' - - SELECT team_id, - count(distinct session_id) as count - FROM session_replay_events - GROUP BY team_id - ' ---- -# name: TestFeatureFlagsUsageReport.test_usage_report_decide_requests.6 - ' - - SELECT distinct_id as team, - sum(JSONExtractInt(properties, 'count')) as sum - FROM events - WHERE team_id = 2 - AND event='decide usage' - AND timestamp between '2022-01-10 00:00:00' AND '2022-01-10 23:59:59' - AND has(['correct'], replaceRegexpAll(JSONExtractRaw(properties, 'token'), '^"|"$', '')) - GROUP BY team - ' ---- -# name: TestFeatureFlagsUsageReport.test_usage_report_decide_requests.7 - ' - - SELECT distinct_id as team, - sum(JSONExtractInt(properties, 'count')) as sum - FROM events - WHERE team_id = 2 - AND event='decide usage' - AND timestamp between '2022-01-01 00:00:00' AND '2022-01-10 23:59:59' - AND has(['correct'], replaceRegexpAll(JSONExtractRaw(properties, 'token'), '^"|"$', '')) - GROUP BY team - ' ---- -# name: TestFeatureFlagsUsageReport.test_usage_report_decide_requests.8 - ' - - SELECT distinct_id as team, - sum(JSONExtractInt(properties, 'count')) as sum - FROM events - WHERE team_id = 2 - AND event='local evaluation usage' - AND timestamp between '2022-01-10 00:00:00' AND '2022-01-10 23:59:59' - AND has(['correct'], replaceRegexpAll(JSONExtractRaw(properties, 'token'), '^"|"$', '')) - GROUP BY team - ' ---- -# name: TestFeatureFlagsUsageReport.test_usage_report_decide_requests.9 - ' - - SELECT distinct_id as team, - sum(JSONExtractInt(properties, 'count')) as sum - FROM events - WHERE team_id = 2 - AND event='local evaluation usage' - AND timestamp between '2022-01-01 00:00:00' AND '2022-01-10 23:59:59' - AND has(['correct'], replaceRegexpAll(JSONExtractRaw(properties, 'token'), '^"|"$', '')) - GROUP BY team - ' ---- diff --git a/posthog/tasks/test/test_usage_report.py b/posthog/tasks/test/test_usage_report.py index 53733d684d0a1..5ad1517636efe 100644 --- a/posthog/tasks/test/test_usage_report.py +++ b/posthog/tasks/test/test_usage_report.py @@ -165,14 +165,6 @@ def _create_sample_usage_data(self) -> None: team=self.org_1_team_1, ) - _create_event( - distinct_id=distinct_id, - event="survey sent", - properties={"$survey_response": "cooool"}, - timestamp=now() - relativedelta(hours=12), - team=self.org_1_team_1, - ) - # Events before the period for _ in range(0, 10): _create_event( @@ -299,13 +291,6 @@ def _create_sample_usage_data(self) -> None: timestamp=now() - relativedelta(hours=12), team=self.org_1_team_2, ) - _create_event( - distinct_id=distinct_id, - event="survey sent", - properties={"$survey_response": "cooool"}, - timestamp=now() - relativedelta(hours=12), - team=self.org_1_team_2, - ) # Events for org 2 team 3 distinct_id = str(uuid4()) @@ -326,13 +311,6 @@ def _create_sample_usage_data(self) -> None: timestamp=now() - relativedelta(hours=12), team=self.org_2_team_3, ) - _create_event( - distinct_id=distinct_id, - event="survey sent", - properties={"$survey_response": "cooool"}, - timestamp=now() - relativedelta(hours=12), - team=self.org_2_team_3, - ) flush_persons_and_events() @@ -1006,6 +984,47 @@ def test_usage_report_survey_responses(self, billing_task_mock: MagicMock, posth assert org_2_report["teams"]["5"]["survey_responses_count_in_period"] == 1 assert org_2_report["teams"]["5"]["survey_responses_count_in_month"] == 7 + @patch("posthog.tasks.usage_report.Client") + @patch("posthog.tasks.usage_report.send_report_to_billing_service") + def test_survey_events_are_not_double_charged( + self, billing_task_mock: MagicMock, posthog_capture_mock: MagicMock + ) -> None: + self._setup_teams() + for i in range(5): + _create_event( + distinct_id="4", + event="survey sent", + properties={ + "$survey_id": "see22eep-o12-as124", + "$survey_response": "correct", + }, + timestamp=now() - relativedelta(hours=i), + team=self.org_1_team_1, + ) + _create_event( + distinct_id="4", + event="survey shown", + timestamp=now() - relativedelta(hours=i), + team=self.org_1_team_1, + ) + _create_event( + distinct_id="4", + event="survey dismissed", + timestamp=now() - relativedelta(hours=i), + team=self.org_1_team_1, + ) + flush_persons_and_events() + period = get_previous_day(at=now() + relativedelta(days=1)) + period_start, period_end = period + all_reports = _get_all_org_reports(period_start, period_end) + report = _get_full_org_usage_report_as_dict( + _get_full_org_usage_report(all_reports[str(self.org_1.id)], get_instance_metadata(period)) + ) + assert report["organization_name"] == "Org 1" + assert report["survey_responses_count_in_month"] == 5 + assert report["event_count_in_period"] == 0 + assert report["event_count_in_month"] == 0 + @freeze_time("2022-01-10T00:01:00Z") class TestExternalDataSyncUsageReport(ClickhouseDestroyTablesMixin, TestCase, ClickhouseTestMixin): diff --git a/posthog/tasks/usage_report.py b/posthog/tasks/usage_report.py index e434d25ff298e..03eb195442b04 100644 --- a/posthog/tasks/usage_report.py +++ b/posthog/tasks/usage_report.py @@ -393,7 +393,7 @@ def get_teams_with_billable_event_count_in_period( f""" SELECT team_id, count({distinct_expression}) as count FROM events - WHERE timestamp between %(begin)s AND %(end)s AND event != '$feature_flag_called' AND event != 'survey sent' + WHERE timestamp between %(begin)s AND %(end)s AND event != '$feature_flag_called' AND event NOT IN ('survey sent', 'survey shown', 'survey dismissed') GROUP BY team_id """, {"begin": begin, "end": end}, From 1166e9b62a85d3556e75848fed7742d10b4cf314 Mon Sep 17 00:00:00 2001 From: Li Yi Yu Date: Wed, 22 Nov 2023 14:12:53 -0500 Subject: [PATCH 3/4] fix event count in test --- .../tasks/test/__snapshots__/test_usage_report.ambr | 6 ++++++ posthog/tasks/test/test_usage_report.py | 12 ++++++------ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/posthog/tasks/test/__snapshots__/test_usage_report.ambr b/posthog/tasks/test/__snapshots__/test_usage_report.ambr index 9cabd193acff2..3cadd9faae952 100644 --- a/posthog/tasks/test/__snapshots__/test_usage_report.ambr +++ b/posthog/tasks/test/__snapshots__/test_usage_report.ambr @@ -15,6 +15,9 @@ FROM events WHERE timestamp between '2022-01-10 00:00:00' AND '2022-01-10 23:59:59' AND event != '$feature_flag_called' + AND event NOT IN ('survey sent', + 'survey shown', + 'survey dismissed') GROUP BY team_id ' --- @@ -196,6 +199,9 @@ FROM events WHERE timestamp between '2022-01-01 00:00:00' AND '2022-01-10 23:59:59' AND event != '$feature_flag_called' + AND event NOT IN ('survey sent', + 'survey shown', + 'survey dismissed') GROUP BY team_id ' --- diff --git a/posthog/tasks/test/test_usage_report.py b/posthog/tasks/test/test_usage_report.py index 4a5f57b829554..259d3a8163cbc 100644 --- a/posthog/tasks/test/test_usage_report.py +++ b/posthog/tasks/test/test_usage_report.py @@ -366,9 +366,9 @@ def _test_usage_report(self) -> List[dict]: }, "plugins_enabled": {"Installed and enabled": 1}, "instance_tag": "none", - "event_count_lifetime": 55, - "event_count_in_period": 23, - "event_count_in_month": 43, + "event_count_lifetime": 54, + "event_count_in_period": 22, + "event_count_in_month": 42, "event_count_with_groups_in_period": 2, "recording_count_in_period": 5, "recording_count_total": 16, @@ -408,9 +408,9 @@ def _test_usage_report(self) -> List[dict]: "team_count": 2, "teams": { str(self.org_1_team_1.id): { - "event_count_lifetime": 44, - "event_count_in_period": 13, - "event_count_in_month": 33, + "event_count_lifetime": 43, + "event_count_in_period": 12, + "event_count_in_month": 32, "event_count_with_groups_in_period": 2, "recording_count_in_period": 0, "recording_count_total": 0, From 4bd33f5ee97e971b41f31e53973de6ba655262e5 Mon Sep 17 00:00:00 2001 From: Li Yi Yu Date: Thu, 30 Nov 2023 13:10:29 -0500 Subject: [PATCH 4/4] fix tests --- posthog/tasks/test/test_usage_report.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/posthog/tasks/test/test_usage_report.py b/posthog/tasks/test/test_usage_report.py index 259d3a8163cbc..a10d8146d4ac8 100644 --- a/posthog/tasks/test/test_usage_report.py +++ b/posthog/tasks/test/test_usage_report.py @@ -366,7 +366,7 @@ def _test_usage_report(self) -> List[dict]: }, "plugins_enabled": {"Installed and enabled": 1}, "instance_tag": "none", - "event_count_lifetime": 54, + "event_count_lifetime": 55, "event_count_in_period": 22, "event_count_in_month": 42, "event_count_with_groups_in_period": 2, @@ -408,7 +408,7 @@ def _test_usage_report(self) -> List[dict]: "team_count": 2, "teams": { str(self.org_1_team_1.id): { - "event_count_lifetime": 43, + "event_count_lifetime": 44, "event_count_in_period": 12, "event_count_in_month": 32, "event_count_with_groups_in_period": 2,