bugwatch docs

Python

For agents: paste the DSN from list_keys into the snippet for the platform; create the project with the matching platform id (create_project(org="acme", slug="web", name="Web", platform="django")). Platforms on this page: django, flask, fastapi.

Python apps use sentry-sdk with the framework extra. Init as early as the process starts (settings module, app factory, module import) so WSGI/ASGI workers, management commands, and job runners all pick it up. Keep send_default_pii=False — Bugwatch scrubs sensitive keys server-side anyway and never stores client IPs unless the project opts in.

Replace https://<public_key>@ingest.bugwatch.io/<project_number> with the DSN from list_keys or the project's settings page.

Django

  • Platform id: django · Language: Python · Runs in: server
  • Install: pip install 'sentry-sdk[django]'
  • Files: settings.py
import sentry_sdk
from sentry_sdk.integrations.django import DjangoIntegration

sentry_sdk.init(
    dsn="https://<public_key>@ingest.bugwatch.io/<project_number>",
    integrations=[DjangoIntegration()],
    traces_sample_rate=1.0,
    send_default_pii=False,   # Bugwatch scrubs server-side anyway
    release=os.environ.get("RELEASE"),
)

Lifecycle notes:

  • Init in settings.py so management commands, Celery workers and WSGI/ASGI all pick it up.
  • The middleware is installed automatically; view exceptions, template errors and 500s are reported with request context.
  • Celery: add CeleryIntegration so task failures and retries report with task args (scrubbed).

Flask

  • Platform id: flask · Language: Python · Runs in: server
  • Install: pip install 'sentry-sdk[flask]'
import sentry_sdk
from sentry_sdk.integrations.flask import FlaskIntegration

sentry_sdk.init(dsn="https://<public_key>@ingest.bugwatch.io/<project_number>", integrations=[FlaskIntegration()], traces_sample_rate=1.0)
app = Flask(__name__)

Lifecycle notes:

  • Init before creating the Flask app so the integration hooks got_request_exception and the before/after request signals.

FastAPI

  • Platform id: fastapi · Language: Python · Runs in: server
  • Install: pip install 'sentry-sdk[fastapi]'
import sentry_sdk
sentry_sdk.init(dsn="https://<public_key>@ingest.bugwatch.io/<project_number>", traces_sample_rate=1.0)  # Starlette/FastAPI integrations auto-enable
app = FastAPI()

Lifecycle notes:

  • Init before FastAPI() — the ASGI middleware is inserted at app creation.
  • Background tasks and uvicorn workers each need init in their process (init at module import handles it).

Symbolication for this family

Python frames arrive with file, line, and source context from the SDK; no upload step. Set release from your deploy pipeline so regressions and resolved_in_release work.