Grab the Sentry Python SDK:
pip install --upgrade sentry-sdk
Configure your DSN:
from fastapi import FastAPI import sentry_sdk from sentry_sdk.integrations.starlette import StarletteIntegration from sentry_sdk.integrations.fastapi import FastApiIntegration sentry_sdk.init( dsn="https://<key>@sentry.io/<project>", integrations=[ StarletteIntegration(), FastApiIntegration(), ], # Set traces_sample_rate to 1.0 to capture 100% # of transactions for performance monitoring. # We recommend adjusting this value in production, traces_sample_rate=1.0, # If you wish to associate users to errors (assuming you are using # django.contrib.auth) you may enable sending PII data. send_default_pii=True, ) app = FastAPI()
See FastAPI stack trace details like the class and method names so you never have to guess. Filter and group FastAPI exceptions intuitively to eliminate noise. Monitor errors at scale without impacting throughput in production.
Quickly identify FastAPI performance issues before they become downtime with performance monitoring. View the entire end-to-end distributed trace to see the exact, poor-performing API call and surface any related errors.
Expose the important events that led to each FastAPI exception: app lifecycle, user actions, debug logs, network requests, past errors.
With Sentry's exceptional exception handling in FastAPI, you can triage quickly based on specific parameters like platform, device type, or page name, for each issue. Set custom tags to recreate the error environment relevant to your app, business concerns, and users.
Just look at all the high-quality security features all accounts get, regardless of plan.
When Spring Boot is configured to generate Git information every event triggered by Sentry will have a release field set to the current Git commit ID that will enable Monitor Release Health Sentry feature. More details here.