Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: remove ingestion experiment #21583

Merged
merged 3 commits into from
Apr 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 0 additions & 1 deletion bin/start
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 0 additions & 1 deletion docker-compose.hobby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion frontend/src/lib/constants.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -337,11 +337,7 @@ export const sessionRecordingDataLogic = kea<sessionRecordingDataLogicType>([
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 ?? []
},
},
Expand All @@ -353,7 +349,6 @@ export const sessionRecordingDataLogic = kea<sessionRecordingDataLogicType>([
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()
Expand All @@ -368,7 +363,7 @@ export const sessionRecordingDataLogic = kea<sessionRecordingDataLogicType>([
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) => {
Expand Down
1 change: 0 additions & 1 deletion posthog/management/commands/sync_feature_flags.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
"cloud-announcement",
"session-reset-on-load",
"posthog-3000-nav",
"session-replay-v3-ingestion-playback",
]


Expand Down
26 changes: 1 addition & 25 deletions posthog/session_recordings/session_recording_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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)
Expand All @@ -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:
Expand Down
3 changes: 0 additions & 3 deletions posthog/settings/object_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
3 changes: 0 additions & 3 deletions posthog/settings/session_replay.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Loading