0.2.3 • Published 1 month ago
@stacksleuth/fastapi-agent v0.2.3
@stacksleuth/fastapi-agent
StackSleuth FastAPI Agent
🚀 What is StackSleuth FastAPI Agent?
Python FastAPI performance monitoring agent - Route-level tracing, WebSocket integration, request/response profiling, middleware performance analysis, and real-time API metrics collection.
✨ Key Features
- 🚀 FastAPI Route Tracing: Automatic endpoint performance monitoring
- 🔄 WebSocket Support: Real-time monitoring with WebSocket integration
- 📊 Request/Response Profiling: Detailed HTTP transaction analysis
- 🔧 Middleware Integration: FastAPI middleware performance tracking
- 🐍 Async Support: Full async/await performance monitoring
- 📈 API Metrics: RESTful API performance analytics
- 🛡️ Dependency Tracking: FastAPI dependency injection monitoring
- ⚡ Production Ready: High-performance Python integration
📦 Installation
npm install @stacksleuth/fastapi-agent
yarn add @stacksleuth/fastapi-agent
pnpm add @stacksleuth/fastapi-agent
🏁 Quick Start
from fastapi import FastAPI
from stacksleuth.fastapi import StackSleuthMiddleware, StackSleuth
app = FastAPI()
# Add StackSleuth middleware
app.add_middleware(StackSleuthMiddleware,
enabled=True,
sample_rate=0.1)
# Initialize StackSleuth
stacksleuth = StackSleuth()
@app.get("/users")
async def get_users():
with stacksleuth.span("fetch-users"):
# Your business logic
users = await User.find_all()
return {"users": users}
@app.websocket("/ws")
async def websocket_endpoint(websocket: WebSocket):
await websocket.accept()
# WebSocket monitoring automatically included
📚 Resources
🤝 Contributing
We welcome contributions! Please see our Contributing Guide for details.
📄 License
MIT License - see the LICENSE file for details.
Website • Documentation • NPM Registry • GitHub
Made with ⚡ by StackSleuth