docs: Document manual session tracking for non-WSGI/ASGI projects - #7619
Closed
DawnofGenX wants to merge 1 commit into
Closed
DawnofGenX wants to merge 1 commit into
DawnofGenX wants to merge 1 commit into
Conversation
Contributor
|
Going to close this because we don't have capacity to review the 5 PRs you've opened. |
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.
Summary
Closes #1461. Documents how to add manual session tracking for projects that are not served over WSGI/ASGI (CLIs, workers, daemons), which is what the issue asks for.
The original issue snippet uses the deprecated
Hub+auto_session_tracking(hub)API. This documents the current public APIs instead:sentry_sdk.sessions.track_session(scope, session_mode=...)context manager (the pattern already used internally by the WSGI/ASGI/aiohttp integrations), used together with the publicisolation_scope()context manager.sentry_sdk.start_session()/sentry_sdk.end_session()for explicit control.Changes: a new "Session Tracking" section in
docs/api.rstwith prose + two runnable-style examples, plusautofunctiondirectives fortrack_session,start_session, andend_session(these previously had no home in the docs at all).Context from the thread: @sentrivana already said "go ahead and open a PR" in #1461 (comment).
Test plan
rm -rf docs/_build && uv run --group docs sphinx-build -vv -W -b html docs/ docs/_build— same command as thedocsjob in.github/workflows/ci.yml, exits 0 (warnings would be errors with-W):master(sentry_sdk/api.pystart_session/end_session,sentry_sdk/sessions.pytrack_session,sentry_sdk/__init__.pyexports).Fixes #1461