-
Notifications
You must be signed in to change notification settings - Fork 27
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(feature-flags): support quota limiting for feature flags #228
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
4e40734
added a test too
dmarticus 3673ff5
formatting
dmarticus 61358a6
more formatting and also simpler test data
dmarticus 21991d0
update changelog
dmarticus 9813f99
code review
dmarticus 2b66513
fix recursion
marandaneto 62fec9f
fix
marandaneto 1493a40
fix lint
marandaneto d15a895
Update CHANGELOG.md
dmarticus File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
what should happen if session replay uses a feature flag and now is quota limited, should it stop working as well? if so, I guess we can also do
preferences.remove(SESSION_REPLAY)
if session replay has alinkedFlag
value.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.
Oh, yeah, I didn't think of that scenario – can you tell me more about how session replay with flags works? I'm fine removing it but I don't really understand how session replay and flags overlap in this context.
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.
@Posthog/team-replay would know more but the implementation is straightforward.
https://github.com/PostHog/posthog-android/blob/41ac8e9dbf989348823052c8c0f14c9c0d1fa2fd/posthog/src/main/java/com/posthog/internal/PostHogFeatureFlags.kt#L39C17-L68
https://github.com/PostHog/posthog/blob/31427d51f6a4aa91b45b3f4c49ef019f22c503d3/posthog/api/decide.py#L489
if /decide returns a
linkedFlag
value, that means we have to evaluate this flag locally, so the current approach will break session replay even if you have recordings quota.now the question is, if you have recordings quota, you don't have flags quota, but session replay configs is enabled behind a flag, should it work or not?
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.
well, it should fail closed
generally speaking folk are setting a linked flag to reduce cost/volume. so failing open would be nasty
so, I have a linked flag, but I am past flag quota, decide/config continues to return the linked flag for replay, the SDK never shows it as received because i'm past quota, and replay never starts
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.
then i think the UX is all around how we notify people about being past quota. feels way more important for flags than other products
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 current approach will silently disable session replay since the linked flag won't exist, which will be one more edge case to debug missing recordings on SDKs.
is that the expectation?
ps: there's the quota limiting logging but it's not really specific about session replay, so folks won't get it right away, I think.
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.
yep, at least failing closed :)
ideally we'd register a super property on events if replay or flags or etc are past their quota for debugging (obvs doesn't help if events are past quota)
but yep, the onward journey will be the thing