# Starlette Error & Performance Monitoring

> See important stack trace details like class & method names to help resolve issues faster. Learn more about Starlette error monitoring here.

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

---

Actionable insights to solve Starlette errors.

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

## Install

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

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

Configure your DSN:

```python
from starlette.applications import Starlette

import sentry_sdk
sentry_sdk.init(
    dsn="https://<key>@sentry.io/<project>",

    # 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,

    # 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 = Starlette(routes=[...])
```

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

## Features

### Starlette Error Monitoring with Complete Stack Traces

See Starlette stack trace details like the class and method names so you never have to guess. Filter and group Starlette exceptions intuitively to eliminate noise. Monitor errors at scale without impacting throughput in production.

### Starlette Performance Monitoring

Quickly identify Starlette performance issues before they become downtime with [performance monitoring](https://sentry.io/for/performance/). 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 Starlette Errors

Expose the important events that led to each Starlette exception: app lifecycle, user actions, debug logs, network requests, past errors.

### See the Full Picture of Any Starlette Exception

With Sentry's exceptional exception handling in Starlette, 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.

## 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?**

Sentry now supports suspect commits for Starlette applications, which helps you identify which code changes might have caused errors. Once set up, Sentry will:

Show suspect commits that might have introduced errors

Link to the specific lines of code in your repository

Suggest potential assignees based on who authored the suspect commits

For more information on setup, [read the docs](https://docs.sentry.io/integrations/source-code-mgmt/github/).

**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/starlette/](https://sentry.io/for/starlette/)*
