Skip to content

Commit

Permalink
fix(batch-exports): Do not export site url (#17588)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasfarias authored Sep 22, 2023
1 parent 4d8993e commit be05d73
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
6 changes: 3 additions & 3 deletions posthog/temporal/tests/batch_exports/test_batch_exports.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
Expand Down Expand Up @@ -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,
}
Expand Down Expand Up @@ -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,
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down
3 changes: 2 additions & 1 deletion posthog/temporal/workflows/batch_exports.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down

0 comments on commit be05d73

Please sign in to comment.