-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
[Statsig] Add test gates and events #3659
Conversation
Your Render PR Server URL is https://social-app-pr-3659.onrender.com. Follow its progress at https://dashboard.render.com/web/srv-cojiomol6cac739g4b9g. |
const gate = useGate() | ||
|
||
useEffect(() => { | ||
logEvent('test:all:always', {}) |
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.
Always fires. Baseline.
useEffect(() => { | ||
logEvent('test:all:always', {}) | ||
if (Math.random() < 0.2) { | ||
logEvent('test:all:sometimes', {}) |
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.
Also baseline, but fires less often.
if (Math.random() < 0.1) { | ||
logEvent('test:all:boosted_by_gate1', { | ||
reason: 'base', | ||
}) |
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.
This one doesn't fire as much... unless you're in gate 1 (see below).
}, []) | ||
|
||
return [ | ||
gate('test_gate_1') ? <TestGate1 /> : null, |
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.
Expose everyone to this GK.
|
||
return [ | ||
gate('test_gate_1') ? <TestGate1 /> : null, | ||
shouldExposeToGate2 && gate('test_gate_2') ? <TestGate2 /> : null, |
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.
Expose a smaller % to this gate (note separate sessions increase the probability of exposure because Math.random
for shouldExposeToGate2
is at module level)
if (Math.random() < 0.5) { | ||
logEvent('test:all:boosted_by_gate1', { | ||
reason: 'gate1', | ||
}) |
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.
Makes sure we hit more of these under the first gate.
return null | ||
} | ||
|
||
function TestGate2() { |
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.
Same but for the other gate.
}) | ||
} | ||
if (Math.random() < 0.5) { | ||
logEvent('test:all:boosted_by_both', { |
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.
Both gates boost this one, but neither does it better.
|
* origin/main: (47 commits) Add option to remove quoted post in composer (#3670) Add border radius to GIF loading state (#3669) use mp4 over webm (#3666) Release 1.79 (#3661) Update Japanese translation (#3656) [Statsig] Add test gates and events (#3659) Quick fix to ensure disable 2fa dialog adjusts to keyboard (#3658) Email auth factor (#3602) GIF Viewer (#3605) Ungate profile scroll fix (#3655) rm country param (#3653) [GIFs] Remove consent flow (#3652) [GIFs] Replace GIPHY with Tenor (#3651) properly close the switch account dialog (#3558) [GIFs] Reset scroll on query change (#3642) Update French translations (#3644) [GIFs] Add error boundary to GIF picker (#3643) Revert "Add layout transitions to the composer photo gallery on iOS (#3609)" (#3649) Update Finnish translations (#3630) Update Japanese translations (#3632) ...
This adds some test-only gates and events so we can see if Metric Lifts work as we expect.
See inline comments.