Add one call to your FastAPI or Flask app. Get latency percentiles, per-route error rates, status distribution, and weekly AI-generated anomaly reports — self-hosted, no agents, no SaaS bill.
reqly.instrument(app, service_name="checkout-api")
— that's it
Features
Built specifically for FastAPI and Flask — not a generic agent that ships 50 MB of overhead and a $400/month bill.
instrument() call. No decorators, no manual spans, no config files. Auto-detects FastAPI vs Flask.docker compose up. TimescaleDB + Collector + Dashboard. Your data, your infra.Architecture
Every component is yours — no phone-home, no shared infrastructure.
[Your FastAPI / Flask app] + Reqly SDK ──► POST /v1/ingest (batched, background thread) │ X-Reqly-Key auth · rate-limited [Collector — FastAPI + asyncpg] │ bulk insert [TimescaleDB] ├── request_events (hypertable · 14-day retention) └── continuous aggregates (no cron — auto-refresh): ├── route_latency_1min (p50 / p95 / p99 per minute) ├── route_errors_1hour (error rate per hour) └── route_status_dist_1hour (status codes per hour) │ ┌──────────────┴──────────────────────┐ │ │ [Dashboard] [APScheduler / Lambda] React 19 reads Sunday 23:00 UTC: GET /v1/metrics/* 1. Pull 8w route_errors_1hour 2. Build dow × hour baseline 3. Z-score flag top anomalies 4. POST anomaly JSON → Groq 5. Store report → dashboard
Stack
Every layer has a reason. No bloat, no magic.
| Layer | Technology & reason |
|---|---|
| SDK | Python — threading, httpx, pure ASGI middleware (no Starlette BaseHTTPMiddleware overhead) |
| Collector | FastAPI + asyncpg + APScheduler + slowapi — async throughout, no ORM overhead |
| Database | TimescaleDB — hypertables + continuous aggregates auto-refresh; sub-ms dashboard queries |
| Dashboard | React 19, Vite 8, Tailwind CSS 4, recharts 3, TanStack Query 5 |
| AI | Groq API · Llama 3.3-70b-versatile — statistics first, LLM writes narrative only |
| AWS (optional) | Lambda + EventBridge + S3, deployed via SAM — same job as APScheduler, cloud-native cron |
Live Demo
EventFlow — a real Flask event management app — is instrumented with Reqly. Browse the live metrics or explore the source.
To view metrics: login as Administrator on EventFlow (admin@eventhub.com / Admin@123) → click Metrics in the nav.
Clone to dashboard in under 5 minutes. Includes SDK usage, config reference, and architecture notes.
Optional: a free Groq API key — needed for AI insights. Without it, a plain statistical summary is shown instead.
Open .env and fill in:
Starts 3 containers. First build takes ~2 minutes; subsequent starts are fast.
| Container | URL | Role |
|---|---|---|
| timescaledb | :5432 | Time-series database |
| collector | :8000 · /docs | FastAPI ingest + query + AI insights |
| dashboard | http://localhost:5173 | React dashboard — open this |
http://localhost:8000, then open the dashboard. The AI Insights panel appears at the bottom — click "Regenerate now" to trigger on-demand.Same call for both — instrument() auto-detects FastAPI vs Flask.
Every option can be passed as a kwarg or set via env var. Resolution order: kwarg → env var → default.
| kwarg | env var | default |
|---|---|---|
| service_name | REQLY_SERVICE_NAME | argv[0] basename |
| collector_url | REQLY_COLLECTOR_URL | http://localhost:8000 |
| api_key | REQLY_API_KEY | None |
| sample_rate | REQLY_SAMPLE_RATE | 1.0 |
| flush_interval_seconds | REQLY_FLUSH_INTERVAL_SECONDS | 5.0 |
| max_batch_size | REQLY_MAX_BATCH_SIZE | 200 |
| max_queue_size | REQLY_MAX_QUEUE_SIZE | 2000 |
| ignore_routes | REQLY_IGNORE_ROUTES | /health,/metrics |
| capture_request_body | REQLY_CAPTURE_REQUEST_BODY | False |
[Your app + Reqly SDK] ──► POST /v1/ingest (batched, background thread, X-Reqly-Key auth) [Collector] writes raw events [TimescaleDB] ├── request_events (14-day retention) ├── route_latency_1min (p50/p95/p99) ├── route_errors_1hour (error rate) └── route_status_dist (status codes) │ ┌──────────────┴──────────────────────┐ [Dashboard] [Weekly job] GET /v1/metrics/* z-score → Groq → report
BaseHTTPMiddleware stream-buffering issues. Direct ASGI callables are both simpler and faster.CI runs all three on every push — .github/workflows/ci.yml