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: 25 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 (27 days ago)
- Default Branch: production
- Last Pushed: 2025-04-23T08:32:21.000Z (27 days ago)
- Last Synced: 2025-04-23T08:52:57.884Z (27 days 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 loggingimport sentry_sdk
from fastapi import FastAPI
from fastapi import Request
from gadfastsentry import SentrySentry(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)
```