Skip to content

docs: Document manual session tracking for non-WSGI/ASGI projects - #7619

Closed
DawnofGenX wants to merge 1 commit into
getsentry:masterfrom
DawnofGenX:docs/issue-1461-manual-session-tracking
Closed

DawnofGenX wants to merge 1 commit into
getsentry:masterfrom
DawnofGenX:docs/issue-1461-manual-session-tracking

Conversation

@DawnofGenX

Copy link
Copy Markdown

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 public isolation_scope() context manager.
  • sentry_sdk.start_session() / sentry_sdk.end_session() for explicit control.

Changes: a new "Session Tracking" section in docs/api.rst with prose + two runnable-style examples, plus autofunction directives for track_session, start_session, and end_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 the docs job in .github/workflows/ci.yml, exits 0 (warnings would be errors with -W):
build succeeded.

The HTML pages are in docs/_build.
  • Verified the documented APIs exist and match their signatures on master (sentry_sdk/api.py start_session/end_session, sentry_sdk/sessions.py track_session, sentry_sdk/__init__.py exports).

Fixes #1461

@DawnofGenX
DawnofGenX requested a review from a team as a code owner September 22, 2026 18:24
@alexander-alderman-webb

Copy link
Copy Markdown
Contributor

Going to close this because we don't have capacity to review the 5 PRs you've opened.
If you'd like to contribute dedicate your time towards making one good PR. Thanks.

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.

Document manual session tracking

2 participants