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.
This adds enough logging to key parts of the session logic that we should be able to figure out what's going on if something goes wrong. Note that agents are numbered (using WeakMap), tokens are sent as hashes (so we can trace what happens to each of them over time).
Test Plan
Allowlist your stable ID (
Statsig.getStableID()
) for thedebug_session
gate. We'll only enable it for the few users who reported problems. Observe events rolling in. (Don't forget to turn on "Show non-production logs"!)Note that there's a notion of separate "realms" (
realmId
) which correspond to browser tabs or app instances, a notion of separate "messages" (which are JSON objects describing what happened), and "slices" (which is an artifact of the transport — Statsig forces us to break apart the logs into smaller chunks or it'll refuse to send them). Since this is all for manual debugging, I think that's fine. I might write a script to reconstruct it in a readable form if needed.Also note that this is done by stable ID so it's able to debug across account switches and logouts.