Skip to content
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

[Session] Logging #4476

Merged
merged 3 commits into from
Jun 20, 2024
Merged

[Session] Logging #4476

merged 3 commits into from
Jun 20, 2024

Conversation

gaearon
Copy link
Contributor

@gaearon gaearon commented Jun 11, 2024

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).

  • Basic implementation
  • Add gate (by stable ID)
  • Send logs when the gate is on

Test Plan

Allowlist your stable ID (Statsig.getStableID()) for the debug_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"!)

Screenshot 2024-06-20 at 05 33 32

Screenshot 2024-06-20 at 05 33 40

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.

Copy link

render bot commented Jun 11, 2024

Copy link

github-actions bot commented Jun 11, 2024

Old size New size Diff
6.3 MB 6.3 MB 1.68 KB (0.03%)

@gaearon gaearon changed the title [Session][WIP] Logging [Session] Logging Jun 20, 2024
@gaearon gaearon marked this pull request as ready for review June 20, 2024 02:43
@pfrazee pfrazee self-assigned this Jun 20, 2024
Copy link
Member

@estrattonbailey estrattonbailey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, haven't run yet though

Copy link
Collaborator

@pfrazee pfrazee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay -- dont have strong opinions about how youve constructed the data you're sending up, but it does seem to function as intended. I was able to confirm the data is sending up by opting into the experiment.

@pfrazee pfrazee merged commit 4c48a1f into main Jun 20, 2024
6 checks passed
@pfrazee pfrazee deleted the log-session branch June 20, 2024 22:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants