-
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: Don't Label Users as Quota Limited for N Days After They Exceed Their Quota #19938
Conversation
Background and requirements:
Approaches:
For both approaches, we can send events to posthog marking when a user should have been quota limited and when the temporary suspension of quota limiting ended. We can then use usage reports to estimate the usage that would have been dropped had quota limiting been in effect. This PR partially implements approach 1. Here is a PR for approach 2. @raquelmsmith More or less sums it up? It's looking like the feature flags approach makes the most sense, unless @neilkakkar identifies an issue. |
39a1668
to
38132ee
Compare
We're going to keep this strategy in place as a failsafe to complement the manual, feature-flag based retention trigger: #19996 |
📸 UI snapshots have been updated6 snapshot changes in total. 0 added, 6 modified, 0 deleted:
Triggered by this commit. |
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.
Logic looks good here, just a couple questions about code hygiene.
I wonder what is the best way to use this and keep an eye on it. Like should we have an alert of some sort when the number of teams who would have been limited goes up?
summary["retained_period_end"] = data_retained_until | ||
needs_save = True | ||
|
||
if billing_period_end: |
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.
When would we not have a billing period end?
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 can't imagine why we wouldn't have one. This is here simply to be consistent with the previous check if is_quota_limited and billing_period_end:
It seems like we'd be most interested in keeping tabs on whether certain orgs are incorrectly having data retained. That would imply we're not correctly inserting and removing them from the data-retention redis set. I think we should create a dashboard similar to the existing quota limiting one, or simply add graphs for data retention to that dashboard. |
… Their Quota (#19938) * wip * add tests * fix up mypy * Update query snapshots * Update query snapshots * address pr feedback * small updates * fix tests * use better types and no key defaults * fix typing * fix up some test setup --------- Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Raquel Smith <[email protected]>
Problem
N = 7. We had discussed making N = 3 because 7 might just be too many days.
We would like to keep users' data for N days after they start to exceed their usage quotas. This will allow us to recover in a case where billing limits inadvertently become lower than current usage (INC-144). This PR introduces a new redis cache and additional metadata on the cached usage dict in posthog to record this temporary state.
Working on tests 🔨
Changes
👉 Stay up-to-date with PostHog coding conventions for a smoother review.
How did you test this code?