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"
- Package:
- pypi:sentry-sdk
- Version:
- 2.12.0
- Repository:
- https://github.com/getsentry/sentry-python