Chalice
Install sentry-sdk
from PyPI with the chalice
extra:
Copied
pip install --upgrade sentry-sdk[chalice]
Copied
from chalice import Chalice
import sentry_sdk
from sentry_sdk.integrations.chalice import ChaliceIntegration
sentry_sdk.init(
dsn="https://examplePublicKey@o0.ingest.sentry.io/0",
enable_tracing=True,
integrations=[
ChaliceIntegration(),
],
)
app = Chalice(app_name="appname")
Copied
from chalice import Chalice
sentry_sdk.init(...) # as above
app = Chalice(app_name="helloworld")
@app.schedule(Rate(1, unit=Rate.MINUTES))
def every_minute(event):
1/0 # raises an error
@app.route("/")
def index():
1/0 # raises an error
return {"hello": "world"}
When you enter the "/"
route or the scheduled task is run, an error event will be sent to sentry.io.
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.
- Chalice: 1.16.0+
- Python: 3.6+
Help improve this content
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) or suggesting an update ("yeah, this would be better").
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) or suggesting an update ("yeah, this would be better").
- Package:
- pypi:sentry-sdk
- Version:
- 2.0.0
- Repository:
- https://github.com/getsentry/sentry-python
- API Documentation:
- https://getsentry.github.io/sentry-python/