-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(integrations) Add docs for LitestarIntegration
- Loading branch information
1 parent
309bc10
commit 086a152
Showing
4 changed files
with
69 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
--- | ||
title: Litestar | ||
description: "Learn about using Sentry with Litestar." | ||
--- | ||
|
||
The Litestar integration adds support for the [Litestar framework](https://docs.litestar.dev/2/). | ||
|
||
## Install | ||
|
||
Install `sentry-sdk` from PyPI with the `litestar` extra: | ||
|
||
```bash | ||
pip install --upgrade 'sentry-sdk[litestar]' uvicorn | ||
``` | ||
|
||
## Configure | ||
|
||
If you have the `litestar` package in your dependencies, the Litestar integration will be enabled automatically when you initialize the Sentry SDK. | ||
|
||
<PlatformContent includePath="getting-started-config" /> | ||
|
||
## Verify | ||
|
||
```python | ||
from litestar import Litestar, get | ||
|
||
sentry_sdk.init(...) # same as above | ||
|
||
@get("/hello") | ||
async def hello_world() -> str: | ||
1 / 0 | ||
return "Hello!" | ||
|
||
app = Litestar(route_handlers=[hello_world]) | ||
``` | ||
|
||
Save the file above as `app.py` and start the development server with: | ||
|
||
```bash | ||
uvicorn app:app | ||
``` | ||
|
||
When you point your browser to [http://localhost:8000/hello](http://localhost:8000/hello) a transaction will be created in the Performance section of [sentry.io](https://sentry.io). Additionally, the `ZeroDivisionError` we've snuck into our `hello_world` handler will be sent to [sentry.io](https://sentry.io) and will be connected to the transaction. | ||
|
||
It takes a couple of moments for the data to appear in [sentry.io](https://sentry.io). | ||
|
||
## Supported Versions | ||
|
||
<Alert level="warning" title="Note"> | ||
|
||
Litestar was [renamed from Starlite](https://litestar.dev/about/organization.html#litestar-and-starlite) | ||
with the release of version 2.0. We support different integrations for each one. This guide applies to Litestar. | ||
See [Starlite integration](/platforms/python/integrations/starlite) for the guide that applies to Starlite. | ||
|
||
</Alert> | ||
|
||
- Litestar: 2.0.0+ | ||
- Python: 3.8+ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters