# FastAPI Error & Performance Monitoring

> Monitor errors at scale without impacting production with our FastAPI error monitoring. Discover how to quickly identify FastAPI performance issues here.

**URL:** https://sentry.io/for/fastapi/

---

Actionable insights to solve FastAPI errors.

**Documentation:** [https://docs.sentry.io/platforms/python/integrations/fastapi/](https://docs.sentry.io/platforms/python/integrations/fastapi/)

## Install

Grab the [Sentry Python SDK](https://github.com/getsentry/sentry-python):

```bash
pip install --upgrade sentry-sdk
```

Initialize the SDK before creating your app. The FastAPI integration is enabled automatically.

```python
import sentry_sdk
from fastapi import FastAPI

sentry_sdk.init(
    dsn="https://<key>@sentry.io/<project>",
    # Add data like request headers and IP for users, if applicable;
    # see https://docs.sentry.io/platforms/python/data-management/data-collected/ for more info
    send_default_pii=True,
    # Set traces_sample_rate to 1.0 to capture 100%
    # of transactions for tracing.
    # We recommend adjusting this value in production.
    traces_sample_rate=1.0,
)

app = FastAPI()
```

See the [FastAPI docs](https://docs.sentry.io/platforms/python/integrations/fastapi/) for full setup options.

## Features

### FastAPI Error Monitoring with Complete Stack Traces

See FastAPI stack traces with file names, line numbers, and local variables for every frame, so you never have to guess. Filter and group FastAPI exceptions intuitively to eliminate noise. Monitor errors at scale without impacting throughput in production.

### FastAPI Performance Monitoring

Quickly identify FastAPI performance issues before they become downtime with [Tracing](/product/tracing/). View the entire end-to-end distributed trace to see the exact, poor-performing API call and surface any related errors.

### Fill In The Blanks About FastAPI Errors

Expose the important events that led to each FastAPI exception: incoming requests, SQL queries, debug logs, outbound HTTP calls, past errors.

### See the Full Picture of Any FastAPI Exception

With Sentry's exceptional exception handling in FastAPI, you can triage quickly based on specific parameters like endpoint, HTTP method, server, or release, for each issue. Set custom tags to recreate the error environment relevant to your app, business concerns, and users.

## FAQ

**What is the difference between Sentry and traditional logging?**

Traditional logging provides you with a trail of events. Some of those events are errors, but many times they're simply informational. Sentry is fundamentally different because we focus on exceptions, or in other words, we capture application crashes. We discuss in more detail [here](/vs/logging/) and on our [blog](https://blog.sentry.io/lets-get-ready-to-monitor/).

**How do I connect issues to git commits?**

You can set up Suspect Commits to identify which commit likely caused an issue. You can also set up Code Mappings to link stack frames to your source code. See our [documentation](https://docs.sentry.io/integrations/source-code-mgmt/) for more details.

**How much does Sentry cost?**

You can get started for free. Pricing depends on the number of monthly events, transactions, and attachments that you send Sentry. For more details, visit our [pricing page](/pricing/).

---

*Source: [sentry.io/for/fastapi/](https://sentry.io/for/fastapi/)*
