-
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
fix(batch-exports): Include properties in feature_enabled call #17860
fix(batch-exports): Include properties in feature_enabled call #17860
Conversation
@@ -170,11 +170,20 @@ def create(self, validated_data: dict) -> BatchExport: | |||
destination_data = validated_data.pop("destination") | |||
team_id = self.context["team_id"] | |||
|
|||
if validated_data["interval"] not in ("hour", "day", "week") and not posthoganalytics.feature_enabled( | |||
"high-frequency-batch-exports", |
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.
hey @tomasfarias you can try this locally to check if it works or not. (just create the same feature flag in your local env with the same match by and check if it works)
In this case, the feature flag is based on the project
group, and not distinct IDs, which means you need to pass in the groups
parameter with key project
and value as the project ID.
So, you just need to add project
instead of organization
in this case, and the property 'id' in group_properties
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.
One potential gotcha, and reason not to use project and use organisations instead is that currently this will enable it for both, team 2 and 9291 in EU and US both, vs. just those teams in US.
Hence, using org IDs, which are unique across deployments works better usually.
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.
We can switch the flag to organizations. That means the code changes implemented here are enough, right? Thank you for your input!
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've tested things out locally using this branch and flags based on organization and things work 👍 (Discovered a frontend bug while I was at it).
Problem
The backend is returning a 403, even though the flag is enabled for a specific team. Maybe the call is missing properties used in other similar calls?
Changes
Adds arguments to
feature_enabled
call when creating high frequency batch exports.👉 Stay up-to-date with PostHog coding conventions for a smoother review.
How did you test this code?