Repository navigation
fix(analytics): send session_start once per process per day - #291
Merged
Merged
Conversation
The service calls poll() in one process every few minutes, and each poll sent session_start, so an idle install produced about 96 liveness events a day. It is now sent once per process per UTC day, which still shows a long-running idle service as alive. A day is not spent while analytics consent is off.
CodeQL reported the module-level day as an unused global because it was only reassigned through a global statement.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Requested by Ajay Singh · project thread
What changed
bubo servicecallspoll()in one process everyservice_poll_interval_seconds, which defaults to 900. Each poll sentsession_start, so an idle install sent about 96 liveness events a day, and the event name suggested a human session that wasn't there.session_startis sent once per process per UTC day. A long-running idle service still checks in daily, so it keeps showing as alive.run-once, the Action and CLI polls are separate processes, so each of them still sends one.record_session_startremembers the UTC day it last sent under a lock.Verification
tests/test_session_start.pydrives the realpoll()with an idle config and counts the queued PostHog events.test_ui_exportfailures, which also fail on main.ruff checkandcz checkpass.Generated by Claude Code