From 33d13aff4d8dea0ee9f73a3c5493a60944d1ab76 Mon Sep 17 00:00:00 2001 From: David Newell Date: Wed, 17 Apr 2024 15:12:59 +0100 Subject: [PATCH] chore: remove ingestion experiment (#21583) --- .vscode/launch.json | 3 +-- bin/start | 1 - docker-compose.hobby.yml | 1 - frontend/src/lib/constants.tsx | 1 - .../player/sessionRecordingDataLogic.ts | 9 ++----- .../management/commands/sync_feature_flags.py | 1 - .../session_recording_api.py | 26 +------------------ posthog/settings/object_storage.py | 3 --- posthog/settings/session_replay.py | 3 --- 9 files changed, 4 insertions(+), 44 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index 36c386906f1ba..b4206a25f0009 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -72,8 +72,7 @@ "DATABASE_URL": "postgres://posthog:posthog@localhost:5432/posthog", "SKIP_SERVICE_VERSION_REQUIREMENTS": "1", "PRINT_SQL": "1", - "BILLING_SERVICE_URL": "https://billing.dev.posthog.dev", - "RECORDINGS_INGESTER_URL": "http://localhost:6738" + "BILLING_SERVICE_URL": "https://billing.dev.posthog.dev" }, "console": "integratedTerminal", "python": "${workspaceFolder}/env/bin/python", diff --git a/bin/start b/bin/start index 5acde4c7c33f6..4cb46f4ee7a22 100755 --- a/bin/start +++ b/bin/start @@ -7,7 +7,6 @@ trap "trap - SIGTERM && kill -- -$$" SIGINT SIGTERM EXIT export DEBUG=${DEBUG:-1} export SKIP_SERVICE_VERSION_REQUIREMENTS=1 export BILLING_SERVICE_URL=${BILLING_SERVICE_URL:-https://billing.dev.posthog.dev} -export RECORDINGS_INGESTER_URL=${RECORDINGS_INGESTER_URL:-http://localhost:6738} service_warning() { echo -e "\033[0;31m$1 isn't ready. You can run the stack with:\ndocker compose -f docker-compose.dev.yml up\nIf you have already ran that, just make sure that services are starting properly, and sit back.\nWaiting for $1 to start...\033[0m" diff --git a/docker-compose.hobby.yml b/docker-compose.hobby.yml index 2720729a27634..690da88e0e135 100644 --- a/docker-compose.hobby.yml +++ b/docker-compose.hobby.yml @@ -76,7 +76,6 @@ services: SENTRY_DSN: $SENTRY_DSN SITE_URL: https://$DOMAIN SECRET_KEY: $POSTHOG_SECRET - RECORDINGS_INGESTER_URL: http://plugins:6738 depends_on: - db - redis diff --git a/frontend/src/lib/constants.tsx b/frontend/src/lib/constants.tsx index 86163f8154cd8..fff3f335f7449 100644 --- a/frontend/src/lib/constants.tsx +++ b/frontend/src/lib/constants.tsx @@ -200,7 +200,6 @@ export const FEATURE_FLAGS = { SAVED_NOT_PINNED: 'saved-not-pinned', // owner: #team-replay BILLING_UPGRADE_LANGUAGE: 'billing-upgrade-language', // owner: @biancayang NEW_EXPERIMENTS_UI: 'new-experiments-ui', // owner: @jurajmajerik #team-feature-success - SESSION_REPLAY_V3_INGESTION_PLAYBACK: 'session-replay-v3-ingestion-playback', // owner: @benjackwhite SESSION_REPLAY_FILTER_ORDERING: 'session-replay-filter-ordering', // owner: #team-replay SESSION_REPLAY_LINKED_VARIANTS: 'session-replay-linked-variants', // owner: #team-replay REPLAY_ERROR_CLUSTERING: 'session-replay-error-clustering', // owner: #team-replay diff --git a/frontend/src/scenes/session-recordings/player/sessionRecordingDataLogic.ts b/frontend/src/scenes/session-recordings/player/sessionRecordingDataLogic.ts index f986818ecf485..fee0907f3c9e4 100644 --- a/frontend/src/scenes/session-recordings/player/sessionRecordingDataLogic.ts +++ b/frontend/src/scenes/session-recordings/player/sessionRecordingDataLogic.ts @@ -337,11 +337,7 @@ export const sessionRecordingDataLogic = kea([ null as SessionRecordingSnapshotSource[] | null, { loadSnapshotSources: async () => { - const params = { - version: values.featureFlags[FEATURE_FLAGS.SESSION_REPLAY_V3_INGESTION_PLAYBACK] ? '3' : '2', - } - - const response = await api.recordings.listSnapshots(props.sessionRecordingId, params) + const response = await api.recordings.listSnapshots(props.sessionRecordingId) return response.sources ?? [] }, }, @@ -353,7 +349,6 @@ export const sessionRecordingDataLogic = kea([ const params = { source: source.source, blob_key: source.blob_key, - version: values.featureFlags[FEATURE_FLAGS.SESSION_REPLAY_V3_INGESTION_PLAYBACK] ? '3' : '2', } const snapshotLoadingStartTime = performance.now() @@ -368,7 +363,7 @@ export const sessionRecordingDataLogic = kea([ throw new Error('Missing key') } - const blobResponseType = source.source === SnapshotSourceType.blob || params.version === '3' + const blobResponseType = source.source === SnapshotSourceType.blob const response = blobResponseType ? await api.recordings.getBlobSnapshots(props.sessionRecordingId, params).catch((e) => { diff --git a/posthog/management/commands/sync_feature_flags.py b/posthog/management/commands/sync_feature_flags.py index e2637950a3126..df2e8d3257645 100644 --- a/posthog/management/commands/sync_feature_flags.py +++ b/posthog/management/commands/sync_feature_flags.py @@ -8,7 +8,6 @@ "cloud-announcement", "session-reset-on-load", "posthog-3000-nav", - "session-replay-v3-ingestion-playback", ] diff --git a/posthog/session_recordings/session_recording_api.py b/posthog/session_recordings/session_recording_api.py index fb187de520b41..9249d92ae1ccb 100644 --- a/posthog/session_recordings/session_recording_api.py +++ b/posthog/session_recordings/session_recording_api.py @@ -321,8 +321,6 @@ def snapshots(self, request: request.Request, **kwargs): might_have_realtime = True newest_timestamp = None - use_v3_storage = request.GET.get("version", None) == "3" - event_properties = { "team_id": self.team.pk, "request_source": source, @@ -362,13 +360,6 @@ def snapshots(self, request: request.Request, **kwargs): might_have_realtime = False else: blob_prefix = recording.build_blob_ingestion_storage_path() - - if use_v3_storage and settings.OBJECT_STORAGE_SESSION_RECORDING_BLOB_INGESTION_V3_FOLDER: - blob_prefix = blob_prefix.replace( - settings.OBJECT_STORAGE_SESSION_RECORDING_BLOB_INGESTION_FOLDER, - settings.OBJECT_STORAGE_SESSION_RECORDING_BLOB_INGESTION_V3_FOLDER, - ) - blob_keys = object_storage.list_objects(blob_prefix) if blob_keys: @@ -414,19 +405,7 @@ def snapshots(self, request: request.Request, **kwargs): response_data["sources"] = sources elif source == "realtime": - if request.GET.get("version", None) == "3" and settings.RECORDINGS_INGESTER_URL: - with requests.get( - url=f"{settings.RECORDINGS_INGESTER_URL}/api/projects/{self.team.pk}/session_recordings/{str(recording.session_id)}/snapshots", - stream=True, - ) as r: - if r.status_code == 404: - return Response({"snapshots": []}) - - response = HttpResponse(content=r.raw, content_type="application/json") - response["Content-Disposition"] = "inline" - return response - else: - snapshots = get_realtime_snapshots(team_id=self.team.pk, session_id=str(recording.session_id)) or [] + snapshots = get_realtime_snapshots(team_id=self.team.pk, session_id=str(recording.session_id)) or [] event_properties["source"] = "realtime" event_properties["snapshots_length"] = len(snapshots) @@ -451,9 +430,6 @@ def snapshots(self, request: request.Request, **kwargs): file_key = convert_original_version_lts_recording(recording) else: blob_prefix = settings.OBJECT_STORAGE_SESSION_RECORDING_BLOB_INGESTION_FOLDER - if use_v3_storage and settings.OBJECT_STORAGE_SESSION_RECORDING_BLOB_INGESTION_V3_FOLDER: - blob_prefix = settings.OBJECT_STORAGE_SESSION_RECORDING_BLOB_INGESTION_V3_FOLDER - file_key = f"{blob_prefix}/team_id/{self.team.pk}/session_id/{recording.session_id}/data/{blob_key}" url = object_storage.get_presigned_url(file_key, expiration=60) if not url: diff --git a/posthog/settings/object_storage.py b/posthog/settings/object_storage.py index 90465ae7a4342..94351468a76d1 100644 --- a/posthog/settings/object_storage.py +++ b/posthog/settings/object_storage.py @@ -28,8 +28,5 @@ OBJECT_STORAGE_SESSION_RECORDING_LTS_FOLDER = os.getenv( "OBJECT_STORAGE_SESSION_RECORDING_LTS_FOLDER", "session_recordings_lts" ) -OBJECT_STORAGE_SESSION_RECORDING_BLOB_INGESTION_V3_FOLDER = os.getenv( - "OBJECT_STORAGE_SESSION_RECORDING_BLOB_INGESTION_V3_FOLDER", "" -) OBJECT_STORAGE_EXPORTS_FOLDER = os.getenv("OBJECT_STORAGE_EXPORTS_FOLDER", "exports") OBJECT_STORAGE_MEDIA_UPLOADS_FOLDER = os.getenv("OBJECT_STORAGE_MEDIA_UPLOADS_FOLDER", "media_uploads") diff --git a/posthog/settings/session_replay.py b/posthog/settings/session_replay.py index 0df3694d39458..4cd8a429aa028 100644 --- a/posthog/settings/session_replay.py +++ b/posthog/settings/session_replay.py @@ -18,9 +18,6 @@ "REALTIME_SNAPSHOTS_FROM_REDIS_ATTEMPT_TIMEOUT_SECONDS", 0.2, type_cast=float ) - -RECORDINGS_INGESTER_URL = get_from_env("RECORDINGS_INGESTER_URL", "") - REPLAY_EMBEDDINGS_ALLOWED_TEAMS: List[str] = get_list(get_from_env("REPLAY_EMBEDDINGS_ALLOWED_TEAM", "", type_cast=str)) REPLAY_EMBEDDINGS_BATCH_SIZE = get_from_env("REPLAY_EMBEDDINGS_BATCH_SIZE", 10, type_cast=int) REPLAY_EMBEDDINGS_MIN_DURATION_SECONDS = get_from_env("REPLAY_EMBEDDINGS_MIN_DURATION_SECONDS", 30, type_cast=int)