Skip to content

Commit

Permalink
feat(decide): add NEW_ANALYTICS_CAPTURE_SAMPLING_RATE option for slow…
Browse files Browse the repository at this point in the history
…er rollout
  • Loading branch information
xvello committed Oct 26, 2023
1 parent 4c0a619 commit 034efdb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion posthog/api/decide.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,8 @@ def get_decide(request: HttpRequest):
)

if settings.NEW_ANALYTICS_CAPTURE_TEAM_IDS and str(team.id) in settings.NEW_ANALYTICS_CAPTURE_TEAM_IDS:
response["analytics"] = {"endpoint": settings.NEW_ANALYTICS_CAPTURE_ENDPOINT}
if random() < settings.NEW_ANALYTICS_CAPTURE_SAMPLING_RATE:
response["analytics"] = {"endpoint": settings.NEW_ANALYTICS_CAPTURE_ENDPOINT}

if team.session_recording_opt_in and (
on_permitted_recording_domain(team, request) or not team.recording_domains
Expand Down
1 change: 1 addition & 0 deletions posthog/settings/ingestion.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,4 @@

NEW_ANALYTICS_CAPTURE_ENDPOINT = os.getenv("NEW_CAPTURE_ENDPOINT", "/i/v0/e/")
NEW_ANALYTICS_CAPTURE_TEAM_IDS = get_set(os.getenv("NEW_ANALYTICS_CAPTURE_TEAM_IDS", ""))
NEW_ANALYTICS_CAPTURE_SAMPLING_RATE = get_from_env("NEW_ANALYTICS_CAPTURE_SAMPLING_RATE", type_cast=float, default=1.0)

0 comments on commit 034efdb

Please sign in to comment.