From 5870be28b18c22a3c3cb71dd61c3fa1d2a943931 Mon Sep 17 00:00:00 2001 From: James Greenhill Date: Wed, 20 Sep 2023 14:15:38 -0700 Subject: [PATCH] chore: drop event if event type is snapshot (we have migrated to snapshot_items (#17558) * chore: drop event if event type is snapshot (we have migrated to snapshot_items * Add a comment --- posthog/api/capture.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/posthog/api/capture.py b/posthog/api/capture.py index c3b45cafef816..76ce538b27e00 100644 --- a/posthog/api/capture.py +++ b/posthog/api/capture.py @@ -29,7 +29,6 @@ ) from posthog.kafka_client.topics import ( KAFKA_EVENTS_PLUGIN_INGESTION_HISTORICAL, - KAFKA_SESSION_RECORDING_EVENTS, KAFKA_SESSION_RECORDING_SNAPSHOT_ITEM_EVENTS, ) from posthog.logging.timing import timed @@ -142,8 +141,6 @@ def _kafka_topic(event_name: str, data: Dict) -> str: # and other events, we push to a different topic. match event_name: - case "$snapshot": - return KAFKA_SESSION_RECORDING_EVENTS case "$snapshot_items": return KAFKA_SESSION_RECORDING_SNAPSHOT_ITEM_EVENTS case _: @@ -155,6 +152,11 @@ def _kafka_topic(event_name: str, data: Dict) -> str: def log_event(data: Dict, event_name: str, partition_key: Optional[str]): + if event_name == "$snapshot": + # This is deprecated and we should no longer spend any time producing + # these events to kafka. + return + kafka_topic = _kafka_topic(event_name, data) logger.debug("logging_event", event_name=event_name, kafka_topic=kafka_topic)