Production-grade request metrics middleware and SLO alert engine for FastAPI + Redis Streams
Project description
⚡ fastapi-alertengine
Drop-in request monitoring + alerting for FastAPI — in under 60 seconds.
No Prometheus. No Grafana. No dashboards.
Just install → add middleware → get real-time alerts.
🚀 Quick Start
from fastapi import FastAPI
from fastapi_alertengine import RequestMetricsMiddleware, get_alert_engine
import redis
app = FastAPI()
redis_client = redis.Redis.from_url("redis://localhost:6379/0")
app.add_middleware(RequestMetricsMiddleware, redis=redis_client)
⚡ Live Alerts Endpoint
Expose real-time system health:
alert_engine = get_alert_engine(redis_client=redis_client)
@app.get("/health/alerts")
def alerts():
return alert_engine.evaluate(window_size=200)
📊 Example Output
{
"status": "ok | warning | critical",
"metrics": {
"overall_p95_ms": 123.4,
"webhook_p95_ms": 234.5,
"api_p95_ms": 110.2,
"error_rate": 0.03,
"anomaly_score": 0.8,
"sample_size": 187
}
}
⚡ What You Get Instantly
- 📊 P95 latency (overall, API, webhook)
- 🚨 Error rate detection (failure pressure signal)
- 🧠 Anomaly detection vs baseline
- ⚡ Rolling window analysis (real-time)
- 🔌 Simple JSON health endpoint
🧠 Why This Exists
Most FastAPI monitoring stacks require:
- Prometheus
- Grafana
- Complex dashboards
That's overkill for most teams.
fastapi-alertengine gives you the core signals that actually matter:
- Is the system slowing down?
- Are failures increasing?
- Is something anomalous happening right now?
🏦 Financial-Grade Design
This system is derived from production infrastructure used in AnchorFlow.
Designed for:
- High-reliability environments
- Payment orchestration systems
- Audit-friendly monitoring outputs
Key characteristics:
- Deterministic P95 calculation
- Failure pressure signal (error rate)
- Structured JSON output for downstream systems
- Safe middleware (never breaks request flow)
⚙️ Default Thresholds
- P95 Warning: 1000ms
- P95 Critical: 3000ms
- Error Rate Critical: 20%
📦 Public API
AlertEngine
RequestMetricsMiddleware
get_alert_engine
🤖 AI-Agent Friendly
Designed for:
- Claude Code
- GitHub Copilot
- Cursor
Agents can integrate it automatically in seconds.
💼 Production Setup (Starter Pack — $49)
Includes:
- Redis + FastAPI deployment setup
- Alert tuning for real workloads
- Scaling patterns
- Direct support
📩 Contact: advovowabantuevents@gmail.com
🧱 Roadmap
- Slack / email alerting
- Remote alert engine (SaaS)
- Multi-service correlation
- Lightweight dashboard
📜 Requirements
- Python 3.10+
- FastAPI
- Redis
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fastapi_alertengine-1.1.4.tar.gz.
File metadata
- Download URL: fastapi_alertengine-1.1.4.tar.gz
- Upload date:
- Size: 2.6 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8b9cdbd8fb5a1d8c671ddd250b1a08d538bc3c230a38af1507f291b33ca5f64b
|
|
| MD5 |
c38515c87280d8529e88bf4c4c260229
|
|
| BLAKE2b-256 |
8726af9f1ca3dfb839a11111582dd28e6dc3de7840c92b7f01a1f70cb66dc5e5
|
File details
Details for the file fastapi_alertengine-1.1.4-py3-none-any.whl.
File metadata
- Download URL: fastapi_alertengine-1.1.4-py3-none-any.whl
- Upload date:
- Size: 11.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a6799a05c90d3928fd5cb5ba96450c699321882f612aa1d1afb7c3a897cefc9d
|
|
| MD5 |
1bb94906f6efed42cc2f45d3c604ac42
|
|
| BLAKE2b-256 |
655f27d0a174a3eb52e06b15957f729eda852fcbdec44d377a162726bc808b7d
|