-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
feat(django): allow elements chain as string for certain teams #18701
Conversation
Size Change: 0 B Total Size: 1.99 MB ℹ️ View Unchanged
|
…ostHog/posthog into dave/add-elements-chain-flag-in-decide
@@ -37,3 +37,5 @@ | |||
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) | |||
|
|||
ELEMENT_CHAIN_AS_STRING_TEAMS = get_set(os.getenv("ELEMENT_CHAIN_AS_STRING_TEAMS", "")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wasn't aware we had a get_set
, could have used that... Nice!
posthog/api/test/test_decide.py
Outdated
@@ -2991,6 +2991,20 @@ def test_decide_new_capture_activation(self, *args): | |||
self.assertEqual(response.status_code, 200) | |||
self.assertFalse("analytics" in response.json()) | |||
|
|||
@patch("posthog.models.feature_flag.flag_analytics.CACHE_BUCKET_SIZE", 10) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: I don't think we need this mock for this test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
# Conflicts: # posthog/api/test/test_decide.py
Problem
As part of killing elements parsing in plugin-server (#18418), we need to send elements chain as a string from the client (PostHog/posthog-js#823).
Changes
This will add a flag (
elementsChainAsString
) in decide response to allow returning elements chain as a string rather than JSON object ifELEMENT_CHAIN_AS_STRING_TEAMS
is set and includes the current team idRelated PR: https://github.com/PostHog/posthog-cloud-infra/pull/2314
👉 Stay up-to-date with PostHog coding conventions for a smoother review.
How did you test this code?
Added a unit test for when ELEMENT_CHAIN_AS_STRING_TEAMS is set and not set