Flask

The Flask integration adds support for the Flask framework. For more information, see our Flask integration guide.

Copied
import sentry_sdk
from flask import Flask
from sentry_sdk.integrations.flask import FlaskIntegration

sentry_sdk.init(
    dsn="https://examplePublicKey@o0.ingest.sentry.io/0",
    integrations=[FlaskIntegration()]
)

app = Flask(__name__)

Options

transaction_style

The transaction_style option can be used to change the format of transaction name. There are two options available:

  • endpoint (default) - formats based on the endpoint (for example, myendpoint)
  • url - formats based on the route (for example, /myurl/<foo>).
Copied
@app.route("/myurl/<foo>")
def myendpoint():
    return "ok"
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").