diff --git a/docs/platforms/python/integrations/index.mdx b/docs/platforms/python/integrations/index.mdx index ed4b73db514b3..aec135ba94b95 100644 --- a/docs/platforms/python/integrations/index.mdx +++ b/docs/platforms/python/integrations/index.mdx @@ -23,6 +23,7 @@ The Sentry SDK uses integrations to hook into the functionality of popular libra | | ✓ | | | ✓ | | | ✓ | +| | ✓ | | | ✓ | ### Databases diff --git a/docs/platforms/python/integrations/litestar/index.mdx b/docs/platforms/python/integrations/litestar/index.mdx new file mode 100644 index 0000000000000..bee08e3820368 --- /dev/null +++ b/docs/platforms/python/integrations/litestar/index.mdx @@ -0,0 +1,85 @@ +--- +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 + +Add `LitestarIntegration()` to your `integrations` list: + + + + + +```python {"onboardingOptions": {"performance": "6-8", "profiling": "9-12"}} +import sentry_sdk +from sentry_sdk.integrations.litestar import LitestarIntegration + +sentry_sdk.init( + dsn="___PUBLIC_DSN___", + # Set traces_sample_rate to 1.0 to capture 100% + # of transactions for tracing. + traces_sample_rate=1.0, + # Set profiles_sample_rate to 1.0 to profile 100% + # of sampled transactions. + # We recommend adjusting this value in production. + profiles_sample_rate=1.0, + integrations=[ + LitestarIntegration(), + ], +) +``` + +## 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 + + + +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. + + + +- Litestar: 2.0.0+ +- Python: 3.8+ diff --git a/docs/platforms/python/integrations/starlite/index.mdx b/docs/platforms/python/integrations/starlite/index.mdx index 1640d8430d3c8..c6c9970bd17da 100644 --- a/docs/platforms/python/integrations/starlite/index.mdx +++ b/docs/platforms/python/integrations/starlite/index.mdx @@ -49,8 +49,8 @@ It takes a couple of moments for the data to appear in [sentry.io](https://sentr Starlite was [renamed to Litestar](https://litestar.dev/about/organization.html#litestar-and-starlite) -with the release of version 2.0. We don't support Litestar yet, so this guide only applies to Starlite 1.51.14 -and below. +with the release of version 2.0. We support different integrations for each one. This guide applies to Starlite. +See [Litestar integration](/platforms/python/integrations/litestar) for the guide that applies to Litestar. diff --git a/src/middleware.ts b/src/middleware.ts index 63256a8b7bac9..4d1cc92517e21 100644 --- a/src/middleware.ts +++ b/src/middleware.ts @@ -413,6 +413,14 @@ const USER_DOCS_REDIRECTS: Redirect[] = [ from: '/platforms/python/starlite/', to: '/platforms/python/integrations/starlite/', }, + { + from: '/clients/python/integrations/litestar/', + to: '/platforms/python/integrations/litestar/', + }, + { + from: '/platforms/python/litestar/', + to: '/platforms/python/integrations/litestar/', + }, { from: '/platforms/python/beam/', to: '/platforms/python/integrations/beam/',