Server integration
Python Monitoring for FastAPI, Django and Flask
LoggerAI monitors FastAPI, Starlette, Django, Flask and Celery. It times every endpoint under its route template and shows the database queries, outgoing HTTP calls and Redis calls behind it.
What LoggerAI records
- Every endpoint under its route template (/orders/{order_id}): p50, p95, p99, Apdex, status codes, slow and failed requests
- Database queries through SQLAlchemy and Django
- Outgoing HTTP through httpx and requests, and Redis
- Exceptions grouped by cause, with your code first in the stack trace
- Logs at warning and above
- Health checks you define for a database, cache or queue
- Celery tasks and scripts, timed like requests
Python 3.8 or later, with no dependencies. The package is loggerai-sdk; you import it as loggerai.
How to set it up
1. Install the package
pip install loggerai-sdk2. Add your key
Get your project's secret key (sk_live_...) from LoggerAI, on your project's Connect page, and set it in the environment. Without a key nothing is recorded or sent, so local development stays quiet.
LOGGERAI_KEY=sk_live_... LOGGERAI_RELEASE=$GIT_SHA # optional3. FastAPI or Starlette
import loggerai from loggerai.asgi import LoggerAIMiddleware loggerai.init() app = FastAPI() app.add_middleware(LoggerAIMiddleware)4. Django
# settings.py import loggerai loggerai.init() MIDDLEWARE = [ "loggerai.django.LoggerAIMiddleware", # first ... ]5. Check it can reach LoggerAI
python -m loggerai test
See every integration, or what you can do with the data in features.
Questions
- Does LoggerAI read my request bodies?
- Secrets such as passwords, tokens, cookies, API keys and JWTs are masked before anything leaves your server. Request and response bodies are never sent, and users are counted by a one-way hash of their id.
- Does the Python SDK have dependencies?
- No. It has no dependencies and runs on Python 3.8 or later.
Try it on your own app
The Free plan is free for good, and needs no card.