Metadata-Version: 2.4
Name: fabric-monitor
Version: 0.1.0
Summary: A Dashboard Monitoring Tool for Multiple Python Applications
Author-email: Henry Mei <zhihanmeibusy@gmail.com>
License: MIT
Project-URL: Repository, https://github.com/BAIGUANGMEI/fabric
Keywords: monitoring,dashboard,fastapi,flask,api,metrics
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Framework :: FastAPI
Classifier: Framework :: Flask
Classifier: Topic :: System :: Monitoring
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: pydantic>=2.0.0
Requires-Dist: typing-extensions>=4.0.0
Provides-Extra: fastapi
Requires-Dist: fastapi>=0.100.0; extra == "fastapi"
Requires-Dist: starlette>=0.27.0; extra == "fastapi"
Requires-Dist: uvicorn>=0.23.0; extra == "fastapi"
Provides-Extra: flask
Requires-Dist: flask>=2.0.0; extra == "flask"
Provides-Extra: sqlite
Requires-Dist: aiosqlite>=0.19.0; extra == "sqlite"
Provides-Extra: redis
Requires-Dist: redis>=4.0.0; extra == "redis"
Provides-Extra: all
Requires-Dist: fabric-monitor[fastapi,flask,redis,sqlite]; extra == "all"
Provides-Extra: dev
Requires-Dist: pytest>=7.0.0; extra == "dev"
Requires-Dist: pytest-asyncio>=0.21.0; extra == "dev"
Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
Requires-Dist: httpx>=0.24.0; extra == "dev"
Requires-Dist: ruff>=0.1.0; extra == "dev"
Requires-Dist: mypy>=1.0.0; extra == "dev"
Dynamic: license-file

# Fabric Monitor

<p align="center">
  <strong>🔍 Lightweight Python Backend Service Monitoring Framework</strong>
</p>

<p align="center">
  <a href="#features">Features</a> •
  <a href="#installation">Installation</a> •
  <a href="#quick-start">Quick Start</a> •
  <a href="#documentation">Documentation</a> •
  <a href="#contributing">Contributing</a>
</p>

---

## Features

- 🚀 **Zero-Intrusion Integration** - Integrates via middleware with minimal impact on existing code
- 📊 **Real-time Monitoring** - Real-time collection of request data, response times, error rates, and more
- 📝 **Auto Documentation** - Automatically extracts API documentation from code
- 🎨 **Visual Dashboard** - Modern monitoring dashboard built with Vue3
- 🔌 **Extensible Architecture** - Plugin-based design supporting FastAPI, Flask, and more frameworks
- 💾 **Multiple Storage Backends** - Supports memory, SQLite(in dev), Redis(in dev), and other storage options

## Installation

```bash
# Using uv
uv pip install fabric-monitor

# Using pip
pip install fabric-monitor

# Install with FastAPI support
uv pip install "fabric-monitor[fastapi]"

# Install with Flask support
uv pip install "fabric-monitor[flask]"

# Install all optional dependencies
uv pip install "fabric-monitor[all]"
```

## Quick Start

### FastAPI

```python
from fastapi import FastAPI
from fabric import Fabric, FabricConfig

app = FastAPI()

# Initialize Fabric
fabric = Fabric(FabricConfig(app_name="My API"))
fabric.setup(app)

@app.get("/users")
async def get_users():
    return [{"id": 1, "name": "Alice"}]

# Visit http://localhost:8000/fabric to view the monitoring dashboard
```

## Configuration Options

```python
from fabric import FabricConfig

config = FabricConfig(
    app_name="My API",           # Application name
    prefix="/fabric",            # Dashboard route prefix
    enabled=True,                # Enable monitoring
    storage_type="memory",       # Storage type: memory | sqlite | redis
    max_requests=10000,          # Maximum request records
    retention_hours=24,          # Data retention time
    sample_rate=1.0,             # Sampling rate (0.0-1.0)
    exclude_paths=["/health"],   # Excluded paths
    enable_auth=False,           # Enable authentication
    auth_token=None,             # Authentication token
)
```

## Documentation

For detailed documentation, see [Development Documentation](docs/DEVELOPMENT.md)

## Supported Frameworks

| Framework | Status |
|-----------|--------|
| FastAPI | ✅ Supported |
| Flask | ✅ Supported |
| Django | 📋 Planned |

## Supported Storage

| Storage | Status |
|-----------|--------|
| Memory | ✅ Supported |
| SQLite | 🚧 In Development |
| Redis | 🚧 In Development |
| MySQL | 📋 Planned |

## License

MIT License
