https://github.com/alexdemure/gadfastsentry
A production-ready sentry configuration module for Python.
https://github.com/alexdemure/gadfastsentry
fastapi-sentry python-sentry sentry
Last synced: 18 days ago
JSON representation
A production-ready sentry configuration module for Python.
- Host: GitHub
- URL: https://github.com/alexdemure/gadfastsentry
- Owner: AlexDemure
- License: mit
- Created: 2025-04-23T07:01:27.000Z (about 1 year ago)
- Default Branch: production
- Last Pushed: 2025-04-23T08:32:21.000Z (about 1 year ago)
- Last Synced: 2025-04-23T08:52:57.884Z (about 1 year ago)
- Topics: fastapi-sentry, python-sentry, sentry
- Language: Python
- Homepage:
- Size: 1000 Bytes
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
A production-ready sentry configuration module for Python.
---
### Installation
```
pip install gadfastsentry
```
### Usage
```python
import logging
import sentry_sdk
from fastapi import FastAPI
from fastapi import Request
from gadfastsentry import Sentry
Sentry(dsn="***", env="production")
app = FastAPI()
@app.middleware("http")
async def inject_trace(request: Request, call_next):
sentry_sdk.set_extra("trace_id", "12345")
return await call_next(request)
@app.get("/sentry-debug")
async def trigger_error():
try:
division_by_zero = 1 / 0
except Exception as e:
logging.error(str(e), exc_info=True)
```
