The Tornado integration adds support for the Tornado Web Framework.


Install sentry-sdk from PyPI with the tornado extra:

pip install --upgrade sentry-sdk[tornado]

If you're on Python 3.6, you also need the aiocontextvars package:

pip install --upgrade aiocontextvars


If you have the tornado package in your dependencies, the Tornado integration will be enabled automatically when you initialize the Sentry SDK.

import sentry_sdk


class MainHandler(tornado.web.RequestHandler):
    # ...


import asyncio
import tornado

sentry_sdk.init(...)  # same as above

class MainHandler(tornado.web.RequestHandler):
    def get(self):
        1/0  # raises an error
        self.write("Hello, world")

def make_app():
    return tornado.web.Application([
        (r"/", MainHandler),

async def main():
    app = make_app()
    await asyncio.Event().wait()

When you point your browser to http://localhost:8888/ a transaction in the Performance section of will be created. Additionally, an error event will be sent to and will be connected to the transaction.

It takes a couple of moments for the data to appear in


  • 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 to True.

  • 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).

Supported Versions

  • Tornado: 5+
  • Python: 2.7+
Help improve this content
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) to suggesting an update ("yeah, this would be better").