-
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: use feature flag to control whether to quota limit or not #19996
Conversation
b663f8e
to
6dc8ddc
Compare
ee/billing/quota_limiting.py
Outdated
@@ -89,6 +92,14 @@ def org_quota_limited_until(organization: Organization, resource: QuotaResource) | |||
if is_quota_limited and organization.never_drop_data: | |||
return None | |||
|
|||
if is_quota_limited and posthoganalytics.feature_enabled(QUOTA_LIMIT_DATA_RETENTION_FLAG, organization.id): |
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.
Assuming this is a group flag, you need the groups parameter here, along with any potential group properties you'll use to target orgs so this can be evaluated locally quickly
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.
Not quite sure where are the $groupidentify events coming in where you put people into quota limiting / remove them from quota limiting.
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.
It should happen here: https://github.com/PostHog/posthog/blob/master/posthog/event_usage.py#L283
That function should get called here: https://github.com/PostHog/posthog/blob/master/ee/billing/quota_limiting.py#L267
But that event, "organization quota limits changed"
hasn't been seen in 9 months...
|
||
@patch("posthoganalytics.capture") | ||
@patch("posthoganalytics.feature_enabled", return_value=True) | ||
def test_quota_limit_feature_flag_not_on(self, patch_feature_enabled, patch_capture) -> None: |
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.
unsure about this test, flag is on it seems? Is there another reason nothing is captured?
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.
The conditional on line 95 of the quota_limiting.py
file should lazy eval and fail since the org hasn't exceed their quota limit.
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.
Let's merge and keep a close eye. I'd also like to try it out for a bit and make sure it works in prod.
Suspect IssuesThis pull request was deployed and Sentry observed the following issues:
Did you find this useful? React with a 👍 or 👎 |
* use feature flag to control whether to quota limit or not * add simple test * Update query snapshots * fix up the feature flag activation logic * confirm that the fixed feature flag logic works * remove unnecessary change * Update query snapshots * Update query snapshots * fix up tests * another fix for tests * Update query snapshots * still fixing tests * Update query snapshots * pr feedback, more tests * tune up ff enabled call, add capture check to test for quota limit changed * i really need to run tests locally --------- Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Problem
Context here
Changes
👉 Stay up-to-date with PostHog coding conventions for a smoother review.
How did you test this code?