From dae4d17ccc4a0038f68f35d29ba873ed22d4a2a7 Mon Sep 17 00:00:00 2001 From: Manoel Aranda Neto <5731772+marandaneto@users.noreply.github.com> Date: Wed, 4 Dec 2024 09:32:29 +0100 Subject: [PATCH] fix: js lite usage reports (#26613) --- plugin-server/src/utils/utils.ts | 1 - posthog/tasks/test/__snapshots__/test_usage_report.ambr | 2 +- posthog/tasks/test/test_usage_report.py | 2 +- posthog/tasks/usage_report.py | 2 +- 4 files changed, 3 insertions(+), 4 deletions(-) diff --git a/plugin-server/src/utils/utils.ts b/plugin-server/src/utils/utils.ts index bae7b6e78bc38..ccaf793c21c93 100644 --- a/plugin-server/src/utils/utils.ts +++ b/plugin-server/src/utils/utils.ts @@ -544,7 +544,6 @@ export const KNOWN_LIB_VALUES = new Set([ 'posthog-python', '', 'js', - 'posthog-js-lite', 'posthog-node', 'posthog-react-native', 'posthog-ruby', diff --git a/posthog/tasks/test/__snapshots__/test_usage_report.ambr b/posthog/tasks/test/__snapshots__/test_usage_report.ambr index 83f4787642836..2230c532da5ca 100644 --- a/posthog/tasks/test/__snapshots__/test_usage_report.ambr +++ b/posthog/tasks/test/__snapshots__/test_usage_report.ambr @@ -3,7 +3,7 @@ ''' SELECT team_id, - multiIf(event LIKE 'helicone%', 'helicone_events', event LIKE 'langfuse%', 'langfuse_events', event LIKE 'keywords_ai%', 'keywords_ai_events', event LIKE 'traceloop%', 'traceloop_events', JSONExtractString(properties, '$lib') = 'web', 'web_events', JSONExtractString(properties, '$lib') = 'posthog-js-lite', 'web_lite_events', JSONExtractString(properties, '$lib') = 'posthog-node', 'node_events', JSONExtractString(properties, '$lib') = 'posthog-android', 'android_events', JSONExtractString(properties, '$lib') = 'posthog-flutter', 'flutter_events', JSONExtractString(properties, '$lib') = 'posthog-ios', 'ios_events', JSONExtractString(properties, '$lib') = 'posthog-go', 'go_events', JSONExtractString(properties, '$lib') = 'posthog-java', 'java_events', JSONExtractString(properties, '$lib') = 'posthog-react-native', 'react_native_events', JSONExtractString(properties, '$lib') = 'posthog-ruby', 'ruby_events', JSONExtractString(properties, '$lib') = 'posthog-python', 'python_events', JSONExtractString(properties, '$lib') = 'posthog-php', 'php_events', 'other') AS metric, + multiIf(event LIKE 'helicone%', 'helicone_events', event LIKE 'langfuse%', 'langfuse_events', event LIKE 'keywords_ai%', 'keywords_ai_events', event LIKE 'traceloop%', 'traceloop_events', JSONExtractString(properties, '$lib') = 'web', 'web_events', JSONExtractString(properties, '$lib') = 'js', 'web_lite_events', JSONExtractString(properties, '$lib') = 'posthog-node', 'node_events', JSONExtractString(properties, '$lib') = 'posthog-android', 'android_events', JSONExtractString(properties, '$lib') = 'posthog-flutter', 'flutter_events', JSONExtractString(properties, '$lib') = 'posthog-ios', 'ios_events', JSONExtractString(properties, '$lib') = 'posthog-go', 'go_events', JSONExtractString(properties, '$lib') = 'posthog-java', 'java_events', JSONExtractString(properties, '$lib') = 'posthog-react-native', 'react_native_events', JSONExtractString(properties, '$lib') = 'posthog-ruby', 'ruby_events', JSONExtractString(properties, '$lib') = 'posthog-python', 'python_events', JSONExtractString(properties, '$lib') = 'posthog-php', 'php_events', 'other') AS metric, count(1) as count FROM events WHERE timestamp BETWEEN '2022-01-10 00:00:00' AND '2022-01-10 23:59:59' diff --git a/posthog/tasks/test/test_usage_report.py b/posthog/tasks/test/test_usage_report.py index 96293722e7fae..ca5a46af1f914 100644 --- a/posthog/tasks/test/test_usage_report.py +++ b/posthog/tasks/test/test_usage_report.py @@ -353,7 +353,7 @@ def _create_sample_usage_data(self) -> None: # Add events for each SDK sdks = [ "web", - "posthog-js-lite", + "js", "posthog-node", "posthog-android", "posthog-flutter", diff --git a/posthog/tasks/usage_report.py b/posthog/tasks/usage_report.py index 31a285c89f0a2..a2671bd97ebd5 100644 --- a/posthog/tasks/usage_report.py +++ b/posthog/tasks/usage_report.py @@ -475,7 +475,7 @@ def get_all_event_metrics_in_period(begin: datetime, end: datetime) -> dict[str, event LIKE 'keywords_ai%%', 'keywords_ai_events', event LIKE 'traceloop%%', 'traceloop_events', {lib_expression} = 'web', 'web_events', - {lib_expression} = 'posthog-js-lite', 'web_lite_events', + {lib_expression} = 'js', 'web_lite_events', {lib_expression} = 'posthog-node', 'node_events', {lib_expression} = 'posthog-android', 'android_events', {lib_expression} = 'posthog-flutter', 'flutter_events',