Tornado
(New in version : 0.6.3)
The Tornado integration adds support for the Tornado Web Framework. A Tornado version of 5 or greater and Python 3.6 or greater is required.
Install
Install sentry-sdk
from PyPI:
pip install --upgrade sentry-sdk
If you're on Python 3.6, you also need the aiocontextvars
package:
pip install --upgrade aiocontextvars
Configure
Initialize the SDK before starting the server:
import sentry_sdk
from sentry_sdk.integrations.tornado import TornadoIntegration
sentry_sdk.init(
dsn="https://examplePublicKey@o0.ingest.sentry.io/0",
integrations=[TornadoIntegration()]
)
# Your app code here, without changes
class MyHandler(...):
# ...
Behavior
The Tornado integration will be installed for all of your apps and handlers.
All exceptions leading to a Internal Server Error are reported.
Request data is attached to all events: HTTP method, URL, headers, form data, JSON payloads. Sentry excludes raw bodies and multipart file uploads. Sentry also excludes personally identifiable information (such as user ids, usernames, cookies, authorization headers, IP addresses) unless you set
send_default_pii
toTrue
.Each request has a separate scope. Changes to the scope within a view, for example setting a tag, will only apply to events sent as part of the request being handled.
Logging with any logger will create breadcrumbs when the Logging integration is enabled (done by default).
- Package:
- pypi:sentry-sdk
- Version:
- 2.12.0
- Repository:
- https://github.com/getsentry/sentry-python