From be05d73fee0fbd793063b3021fa3e142755ae669 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1s=20Far=C3=ADas=20Santana?= Date: Fri, 22 Sep 2023 16:56:24 +0200 Subject: [PATCH] fix(batch-exports): Do not export site url (#17588) --- posthog/temporal/tests/batch_exports/test_batch_exports.py | 6 +++--- .../batch_exports/test_bigquery_batch_export_workflow.py | 2 +- .../batch_exports/test_postgres_batch_export_workflow.py | 3 ++- posthog/temporal/workflows/batch_exports.py | 3 ++- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/posthog/temporal/tests/batch_exports/test_batch_exports.py b/posthog/temporal/tests/batch_exports/test_batch_exports.py index 50ee763b5d4d9..2bd5dd4084db1 100644 --- a/posthog/temporal/tests/batch_exports/test_batch_exports.py +++ b/posthog/temporal/tests/batch_exports/test_batch_exports.py @@ -270,7 +270,7 @@ async def test_get_results_iterator(client): "elements_chain": "this that and the other", "elements": json.dumps("this that and the other"), "ip": "127.0.0.1", - "site_url": "http://localhost.com", + "site_url": "", "set": None, "set_once": None, } @@ -327,7 +327,7 @@ async def test_get_results_iterator_handles_duplicates(client): "elements_chain": "this that and the other", "elements": json.dumps("this that and the other"), "ip": "127.0.0.1", - "site_url": "http://localhost.com", + "site_url": "", "set": None, "set_once": None, } @@ -387,7 +387,7 @@ async def test_get_results_iterator_can_exclude_events(client): "elements_chain": "this that and the other", "elements": json.dumps("this that and the other"), "ip": "127.0.0.1", - "site_url": "http://localhost.com", + "site_url": "", "set": None, "set_once": None, } diff --git a/posthog/temporal/tests/batch_exports/test_bigquery_batch_export_workflow.py b/posthog/temporal/tests/batch_exports/test_bigquery_batch_export_workflow.py index ad6e511577f85..8a843831217b8 100644 --- a/posthog/temporal/tests/batch_exports/test_bigquery_batch_export_workflow.py +++ b/posthog/temporal/tests/batch_exports/test_bigquery_batch_export_workflow.py @@ -67,7 +67,7 @@ def assert_events_in_bigquery(client, table_id, dataset_id, events, bq_ingested_ "properties": event.get("properties"), "set": properties.get("$set", None) if properties else None, "set_once": properties.get("$set_once", None) if properties else None, - "site_url": properties.get("$current_url", None) if properties else None, + "site_url": "", # For compatibility with CH which doesn't parse timezone component, so we add it here assuming UTC. "timestamp": dt.datetime.fromisoformat(event.get("timestamp") + "+00:00"), "team_id": event.get("team_id"), diff --git a/posthog/temporal/tests/batch_exports/test_postgres_batch_export_workflow.py b/posthog/temporal/tests/batch_exports/test_postgres_batch_export_workflow.py index 831a7e9308ba1..ef98f1725fab1 100644 --- a/posthog/temporal/tests/batch_exports/test_postgres_batch_export_workflow.py +++ b/posthog/temporal/tests/batch_exports/test_postgres_batch_export_workflow.py @@ -66,7 +66,8 @@ def assert_events_in_postgres(connection, schema, table_name, events): "properties": event.get("properties"), "set": properties.get("$set", None) if properties else None, "set_once": properties.get("$set_once", None) if properties else None, - "site_url": properties.get("$current_url", None) if properties else None, + # Kept for backwards compatibility, but not exported anymore. + "site_url": None, # For compatibility with CH which doesn't parse timezone component, so we add it here assuming UTC. "timestamp": dt.datetime.fromisoformat(event.get("timestamp") + "+00:00"), "team_id": event.get("team_id"), diff --git a/posthog/temporal/workflows/batch_exports.py b/posthog/temporal/workflows/batch_exports.py index c79262a0fe86a..4506069dd2bf2 100644 --- a/posthog/temporal/workflows/batch_exports.py +++ b/posthog/temporal/workflows/batch_exports.py @@ -155,7 +155,8 @@ def iter_batch_records(batch) -> typing.Generator[dict[str, typing.Any], None, N "set": properties.get("$set", None) if properties else None, "set_once": properties.get("$set_once", None) if properties else None, "properties": properties, - "site_url": properties.get("$current_url", None) if properties else None, + # Kept for backwards compatibility, but not exported anymore. + "site_url": "", "team_id": record.get("team_id"), "timestamp": record.get("timestamp").isoformat(), "uuid": record.get("uuid").decode(),