fastapi-radar 0.1.3__tar.gz → 0.1.5__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of fastapi-radar might be problematic. Click here for more details.
- {fastapi_radar-0.1.3/fastapi_radar.egg-info → fastapi_radar-0.1.5}/PKG-INFO +56 -20
- fastapi_radar-0.1.5/README.md +158 -0
- {fastapi_radar-0.1.3 → fastapi_radar-0.1.5}/fastapi_radar/__init__.py +1 -1
- {fastapi_radar-0.1.3 → fastapi_radar-0.1.5}/fastapi_radar/radar.py +7 -3
- {fastapi_radar-0.1.3 → fastapi_radar-0.1.5/fastapi_radar.egg-info}/PKG-INFO +56 -20
- {fastapi_radar-0.1.3 → fastapi_radar-0.1.5}/fastapi_radar.egg-info/requires.txt +1 -2
- {fastapi_radar-0.1.3 → fastapi_radar-0.1.5}/pyproject.toml +2 -3
- {fastapi_radar-0.1.3 → fastapi_radar-0.1.5}/setup.py +1 -1
- fastapi_radar-0.1.3/README.md +0 -121
- {fastapi_radar-0.1.3 → fastapi_radar-0.1.5}/CONTRIBUTING.md +0 -0
- {fastapi_radar-0.1.3 → fastapi_radar-0.1.5}/LICENSE +0 -0
- {fastapi_radar-0.1.3 → fastapi_radar-0.1.5}/MANIFEST.in +0 -0
- {fastapi_radar-0.1.3 → fastapi_radar-0.1.5}/fastapi_radar/api.py +0 -0
- {fastapi_radar-0.1.3 → fastapi_radar-0.1.5}/fastapi_radar/capture.py +0 -0
- {fastapi_radar-0.1.3 → fastapi_radar-0.1.5}/fastapi_radar/dashboard/dist/assets/index-CxIRSjZZ.js +0 -0
- {fastapi_radar-0.1.3 → fastapi_radar-0.1.5}/fastapi_radar/dashboard/dist/assets/index-DCxkDBhr.css +0 -0
- {fastapi_radar-0.1.3 → fastapi_radar-0.1.5}/fastapi_radar/dashboard/dist/index.html +0 -0
- {fastapi_radar-0.1.3 → fastapi_radar-0.1.5}/fastapi_radar/middleware.py +0 -0
- {fastapi_radar-0.1.3 → fastapi_radar-0.1.5}/fastapi_radar/models.py +0 -0
- {fastapi_radar-0.1.3 → fastapi_radar-0.1.5}/fastapi_radar/utils.py +0 -0
- {fastapi_radar-0.1.3 → fastapi_radar-0.1.5}/fastapi_radar.egg-info/SOURCES.txt +0 -0
- {fastapi_radar-0.1.3 → fastapi_radar-0.1.5}/fastapi_radar.egg-info/dependency_links.txt +0 -0
- {fastapi_radar-0.1.3 → fastapi_radar-0.1.5}/fastapi_radar.egg-info/not-zip-safe +0 -0
- {fastapi_radar-0.1.3 → fastapi_radar-0.1.5}/fastapi_radar.egg-info/top_level.txt +0 -0
- {fastapi_radar-0.1.3 → fastapi_radar-0.1.5}/setup.cfg +0 -0
- {fastapi_radar-0.1.3 → fastapi_radar-0.1.5}/tests/__init__.py +0 -0
- {fastapi_radar-0.1.3 → fastapi_radar-0.1.5}/tests/test_radar.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: fastapi-radar
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.5
|
|
4
4
|
Summary: A debugging dashboard for FastAPI applications with real-time monitoring
|
|
5
5
|
Home-page: https://github.com/doganarif/fastapi-radar
|
|
6
6
|
Author: Arif Dogan
|
|
@@ -28,8 +28,6 @@ Requires-Dist: fastapi>=0.68.0
|
|
|
28
28
|
Requires-Dist: sqlalchemy>=1.4.0
|
|
29
29
|
Requires-Dist: pydantic>=1.8.0
|
|
30
30
|
Requires-Dist: starlette>=0.14.2
|
|
31
|
-
Requires-Dist: black>=24.8.0
|
|
32
|
-
Requires-Dist: httpx>=0.28.1
|
|
33
31
|
Provides-Extra: dev
|
|
34
32
|
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
|
35
33
|
Requires-Dist: pytest-asyncio>=0.21.0; extra == "dev"
|
|
@@ -38,21 +36,22 @@ Requires-Dist: black>=22.0.0; extra == "dev"
|
|
|
38
36
|
Requires-Dist: isort>=5.10.0; extra == "dev"
|
|
39
37
|
Requires-Dist: flake8>=4.0.0; extra == "dev"
|
|
40
38
|
Requires-Dist: mypy>=0.950; extra == "dev"
|
|
39
|
+
Requires-Dist: httpx>=0.28.1; extra == "dev"
|
|
41
40
|
Dynamic: author
|
|
42
41
|
Dynamic: home-page
|
|
43
42
|
Dynamic: license-file
|
|
44
43
|
Dynamic: requires-python
|
|
45
44
|
|
|
46
|
-
# FastAPI Radar
|
|
45
|
+
# FastAPI Radar
|
|
47
46
|
|
|
48
47
|
[](https://www.python.org/downloads/)
|
|
49
48
|
[](https://opensource.org/licenses/MIT)
|
|
50
49
|
|
|
51
50
|
**A debugging dashboard for FastAPI applications providing real-time request, database query, and exception monitoring.**
|
|
52
51
|
|
|
53
|
-
|
|
52
|
+
**Just one line to add powerful monitoring to your FastAPI app!**
|
|
54
53
|
|
|
55
|
-
##
|
|
54
|
+
## See it in Action
|
|
56
55
|
|
|
57
56
|

|
|
58
57
|
|
|
@@ -76,6 +75,8 @@ pipenv install fastapi-radar
|
|
|
76
75
|
|
|
77
76
|
## Quick Start
|
|
78
77
|
|
|
78
|
+
### With SQL Database (Full Monitoring)
|
|
79
|
+
|
|
79
80
|
```python
|
|
80
81
|
from fastapi import FastAPI
|
|
81
82
|
from fastapi_radar import Radar
|
|
@@ -84,7 +85,7 @@ from sqlalchemy import create_engine
|
|
|
84
85
|
app = FastAPI()
|
|
85
86
|
engine = create_engine("sqlite:///./app.db")
|
|
86
87
|
|
|
87
|
-
#
|
|
88
|
+
# Full monitoring with SQL query tracking
|
|
88
89
|
radar = Radar(app, db_engine=engine)
|
|
89
90
|
radar.create_tables()
|
|
90
91
|
|
|
@@ -94,31 +95,62 @@ async def get_users():
|
|
|
94
95
|
return {"users": []}
|
|
95
96
|
```
|
|
96
97
|
|
|
98
|
+
### Without SQL Database (HTTP & Exception Monitoring)
|
|
99
|
+
|
|
100
|
+
```python
|
|
101
|
+
from fastapi import FastAPI
|
|
102
|
+
from fastapi_radar import Radar
|
|
103
|
+
|
|
104
|
+
app = FastAPI()
|
|
105
|
+
|
|
106
|
+
# Monitor HTTP requests and exceptions only
|
|
107
|
+
# Perfect for NoSQL databases, external APIs, or database-less apps
|
|
108
|
+
radar = Radar(app) # No db_engine parameter needed!
|
|
109
|
+
radar.create_tables()
|
|
110
|
+
|
|
111
|
+
@app.get("/api/data")
|
|
112
|
+
async def get_data():
|
|
113
|
+
# Your MongoDB, Redis, or external API calls here
|
|
114
|
+
return {"data": []}
|
|
115
|
+
```
|
|
116
|
+
|
|
97
117
|
Access your dashboard at: **http://localhost:8000/\_\_radar/**
|
|
98
118
|
|
|
99
119
|
## Features
|
|
100
120
|
|
|
101
|
-
-
|
|
102
|
-
-
|
|
103
|
-
-
|
|
104
|
-
-
|
|
105
|
-
-
|
|
106
|
-
-
|
|
121
|
+
- **Zero Configuration** - Works with any FastAPI app (SQL database optional)
|
|
122
|
+
- **Request Monitoring** - Complete HTTP request/response capture with timing
|
|
123
|
+
- **Database Monitoring** - SQL query logging with execution times (when using SQLAlchemy)
|
|
124
|
+
- **Exception Tracking** - Automatic exception capture with stack traces
|
|
125
|
+
- **Real-time Updates** - Live dashboard updates as requests happen
|
|
126
|
+
- **Flexible Integration** - Use with SQL, NoSQL, or no database at all
|
|
107
127
|
|
|
108
128
|
## Configuration
|
|
109
129
|
|
|
110
130
|
```python
|
|
111
131
|
radar = Radar(
|
|
112
132
|
app,
|
|
113
|
-
db_engine=engine,
|
|
114
|
-
dashboard_path="/__radar",
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
133
|
+
db_engine=engine, # Optional: SQLAlchemy engine for SQL query monitoring
|
|
134
|
+
dashboard_path="/__radar", # Custom dashboard path (default: "/__radar")
|
|
135
|
+
max_requests=1000, # Max requests to store (default: 1000)
|
|
136
|
+
retention_hours=24, # Data retention period (default: 24)
|
|
137
|
+
slow_query_threshold=100, # Mark queries slower than this as slow (ms)
|
|
138
|
+
capture_sql_bindings=True, # Capture SQL query parameters
|
|
139
|
+
exclude_paths=["/health"], # Paths to exclude from monitoring
|
|
140
|
+
theme="auto", # Dashboard theme: "light", "dark", or "auto"
|
|
119
141
|
)
|
|
120
142
|
```
|
|
121
143
|
|
|
144
|
+
## What Gets Captured?
|
|
145
|
+
|
|
146
|
+
- ✅ HTTP requests and responses
|
|
147
|
+
- ✅ Response times and performance metrics
|
|
148
|
+
- ✅ SQL queries with execution times
|
|
149
|
+
- ✅ Query parameters and bindings
|
|
150
|
+
- ✅ Slow query detection
|
|
151
|
+
- ✅ Exceptions with stack traces
|
|
152
|
+
- ✅ Request/response bodies and headers
|
|
153
|
+
|
|
122
154
|
## Contributing
|
|
123
155
|
|
|
124
156
|
We welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) for details.
|
|
@@ -150,10 +182,14 @@ npm run dev # For development with hot reload
|
|
|
150
182
|
npm run build # To rebuild the production bundle
|
|
151
183
|
```
|
|
152
184
|
|
|
153
|
-
4. Run the example
|
|
185
|
+
4. Run the example apps:
|
|
154
186
|
|
|
155
187
|
```bash
|
|
188
|
+
# Example with SQL database
|
|
156
189
|
python example_app.py
|
|
190
|
+
|
|
191
|
+
# Example without SQL database (NoSQL/in-memory)
|
|
192
|
+
python example_nosql_app.py
|
|
157
193
|
```
|
|
158
194
|
|
|
159
195
|
## License
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
# FastAPI Radar
|
|
2
|
+
|
|
3
|
+
[](https://www.python.org/downloads/)
|
|
4
|
+
[](https://opensource.org/licenses/MIT)
|
|
5
|
+
|
|
6
|
+
**A debugging dashboard for FastAPI applications providing real-time request, database query, and exception monitoring.**
|
|
7
|
+
|
|
8
|
+
**Just one line to add powerful monitoring to your FastAPI app!**
|
|
9
|
+
|
|
10
|
+
## See it in Action
|
|
11
|
+
|
|
12
|
+

|
|
13
|
+
|
|
14
|
+
## Installation
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
pip install fastapi-radar
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Or with your favorite package manager:
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
# Using poetry
|
|
24
|
+
poetry add fastapi-radar
|
|
25
|
+
|
|
26
|
+
# Using pipenv
|
|
27
|
+
pipenv install fastapi-radar
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
**Note:** The dashboard comes pre-built! No need to build anything - just install and use.
|
|
31
|
+
|
|
32
|
+
## Quick Start
|
|
33
|
+
|
|
34
|
+
### With SQL Database (Full Monitoring)
|
|
35
|
+
|
|
36
|
+
```python
|
|
37
|
+
from fastapi import FastAPI
|
|
38
|
+
from fastapi_radar import Radar
|
|
39
|
+
from sqlalchemy import create_engine
|
|
40
|
+
|
|
41
|
+
app = FastAPI()
|
|
42
|
+
engine = create_engine("sqlite:///./app.db")
|
|
43
|
+
|
|
44
|
+
# Full monitoring with SQL query tracking
|
|
45
|
+
radar = Radar(app, db_engine=engine)
|
|
46
|
+
radar.create_tables()
|
|
47
|
+
|
|
48
|
+
# Your routes work unchanged
|
|
49
|
+
@app.get("/users")
|
|
50
|
+
async def get_users():
|
|
51
|
+
return {"users": []}
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### Without SQL Database (HTTP & Exception Monitoring)
|
|
55
|
+
|
|
56
|
+
```python
|
|
57
|
+
from fastapi import FastAPI
|
|
58
|
+
from fastapi_radar import Radar
|
|
59
|
+
|
|
60
|
+
app = FastAPI()
|
|
61
|
+
|
|
62
|
+
# Monitor HTTP requests and exceptions only
|
|
63
|
+
# Perfect for NoSQL databases, external APIs, or database-less apps
|
|
64
|
+
radar = Radar(app) # No db_engine parameter needed!
|
|
65
|
+
radar.create_tables()
|
|
66
|
+
|
|
67
|
+
@app.get("/api/data")
|
|
68
|
+
async def get_data():
|
|
69
|
+
# Your MongoDB, Redis, or external API calls here
|
|
70
|
+
return {"data": []}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Access your dashboard at: **http://localhost:8000/\_\_radar/**
|
|
74
|
+
|
|
75
|
+
## Features
|
|
76
|
+
|
|
77
|
+
- **Zero Configuration** - Works with any FastAPI app (SQL database optional)
|
|
78
|
+
- **Request Monitoring** - Complete HTTP request/response capture with timing
|
|
79
|
+
- **Database Monitoring** - SQL query logging with execution times (when using SQLAlchemy)
|
|
80
|
+
- **Exception Tracking** - Automatic exception capture with stack traces
|
|
81
|
+
- **Real-time Updates** - Live dashboard updates as requests happen
|
|
82
|
+
- **Flexible Integration** - Use with SQL, NoSQL, or no database at all
|
|
83
|
+
|
|
84
|
+
## Configuration
|
|
85
|
+
|
|
86
|
+
```python
|
|
87
|
+
radar = Radar(
|
|
88
|
+
app,
|
|
89
|
+
db_engine=engine, # Optional: SQLAlchemy engine for SQL query monitoring
|
|
90
|
+
dashboard_path="/__radar", # Custom dashboard path (default: "/__radar")
|
|
91
|
+
max_requests=1000, # Max requests to store (default: 1000)
|
|
92
|
+
retention_hours=24, # Data retention period (default: 24)
|
|
93
|
+
slow_query_threshold=100, # Mark queries slower than this as slow (ms)
|
|
94
|
+
capture_sql_bindings=True, # Capture SQL query parameters
|
|
95
|
+
exclude_paths=["/health"], # Paths to exclude from monitoring
|
|
96
|
+
theme="auto", # Dashboard theme: "light", "dark", or "auto"
|
|
97
|
+
)
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## What Gets Captured?
|
|
101
|
+
|
|
102
|
+
- ✅ HTTP requests and responses
|
|
103
|
+
- ✅ Response times and performance metrics
|
|
104
|
+
- ✅ SQL queries with execution times
|
|
105
|
+
- ✅ Query parameters and bindings
|
|
106
|
+
- ✅ Slow query detection
|
|
107
|
+
- ✅ Exceptions with stack traces
|
|
108
|
+
- ✅ Request/response bodies and headers
|
|
109
|
+
|
|
110
|
+
## Contributing
|
|
111
|
+
|
|
112
|
+
We welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) for details.
|
|
113
|
+
|
|
114
|
+
### Development Setup
|
|
115
|
+
|
|
116
|
+
For contributors who want to modify the codebase:
|
|
117
|
+
|
|
118
|
+
1. Clone the repository:
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
git clone https://github.com/doganarif/fastapi-radar.git
|
|
122
|
+
cd fastapi-radar
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
2. Install development dependencies:
|
|
126
|
+
|
|
127
|
+
```bash
|
|
128
|
+
pip install -e ".[dev]"
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
3. (Optional) If modifying the dashboard UI:
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
cd fastapi_radar/dashboard
|
|
135
|
+
npm install
|
|
136
|
+
npm run dev # For development with hot reload
|
|
137
|
+
# or
|
|
138
|
+
npm run build # To rebuild the production bundle
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
4. Run the example apps:
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
# Example with SQL database
|
|
145
|
+
python example_app.py
|
|
146
|
+
|
|
147
|
+
# Example without SQL database (NoSQL/in-memory)
|
|
148
|
+
python example_nosql_app.py
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
## License
|
|
152
|
+
|
|
153
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
154
|
+
|
|
155
|
+
## Acknowledgments
|
|
156
|
+
|
|
157
|
+
- Built with [FastAPI](https://fastapi.tiangolo.com/)
|
|
158
|
+
- Dashboard powered by [React](https://react.dev/) and [shadcn/ui](https://ui.shadcn.com/)
|
|
@@ -18,7 +18,7 @@ class Radar:
|
|
|
18
18
|
def __init__(
|
|
19
19
|
self,
|
|
20
20
|
app: FastAPI,
|
|
21
|
-
db_engine: Engine,
|
|
21
|
+
db_engine: Optional[Engine] = None,
|
|
22
22
|
storage_engine: Optional[Engine] = None,
|
|
23
23
|
dashboard_path: str = "/__radar",
|
|
24
24
|
max_requests: int = 1000,
|
|
@@ -37,6 +37,7 @@ class Radar:
|
|
|
37
37
|
self.capture_sql_bindings = capture_sql_bindings
|
|
38
38
|
self.exclude_paths = exclude_paths or []
|
|
39
39
|
self.theme = theme
|
|
40
|
+
self.query_capture = None # Initialize to None
|
|
40
41
|
|
|
41
42
|
# Add all radar paths to excluded paths - exclude everything under /__radar
|
|
42
43
|
if dashboard_path not in self.exclude_paths:
|
|
@@ -61,7 +62,11 @@ class Radar:
|
|
|
61
62
|
|
|
62
63
|
# Initialize components
|
|
63
64
|
self._setup_middleware()
|
|
64
|
-
|
|
65
|
+
|
|
66
|
+
# Only setup query capture if db_engine is provided
|
|
67
|
+
if self.db_engine:
|
|
68
|
+
self._setup_query_capture()
|
|
69
|
+
|
|
65
70
|
self._setup_api()
|
|
66
71
|
self._setup_dashboard()
|
|
67
72
|
|
|
@@ -120,7 +125,6 @@ class Radar:
|
|
|
120
125
|
|
|
121
126
|
# Add a catch-all route for the dashboard SPA
|
|
122
127
|
# This ensures all sub-routes under /__radar serve the index.html
|
|
123
|
-
@self.app.get(f"{self.dashboard_path}")
|
|
124
128
|
@self.app.get(f"{self.dashboard_path}/{{full_path:path}}")
|
|
125
129
|
async def serve_dashboard(request: Request, full_path: str = ""):
|
|
126
130
|
# Check if it's a request for a static asset
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: fastapi-radar
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.5
|
|
4
4
|
Summary: A debugging dashboard for FastAPI applications with real-time monitoring
|
|
5
5
|
Home-page: https://github.com/doganarif/fastapi-radar
|
|
6
6
|
Author: Arif Dogan
|
|
@@ -28,8 +28,6 @@ Requires-Dist: fastapi>=0.68.0
|
|
|
28
28
|
Requires-Dist: sqlalchemy>=1.4.0
|
|
29
29
|
Requires-Dist: pydantic>=1.8.0
|
|
30
30
|
Requires-Dist: starlette>=0.14.2
|
|
31
|
-
Requires-Dist: black>=24.8.0
|
|
32
|
-
Requires-Dist: httpx>=0.28.1
|
|
33
31
|
Provides-Extra: dev
|
|
34
32
|
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
|
35
33
|
Requires-Dist: pytest-asyncio>=0.21.0; extra == "dev"
|
|
@@ -38,21 +36,22 @@ Requires-Dist: black>=22.0.0; extra == "dev"
|
|
|
38
36
|
Requires-Dist: isort>=5.10.0; extra == "dev"
|
|
39
37
|
Requires-Dist: flake8>=4.0.0; extra == "dev"
|
|
40
38
|
Requires-Dist: mypy>=0.950; extra == "dev"
|
|
39
|
+
Requires-Dist: httpx>=0.28.1; extra == "dev"
|
|
41
40
|
Dynamic: author
|
|
42
41
|
Dynamic: home-page
|
|
43
42
|
Dynamic: license-file
|
|
44
43
|
Dynamic: requires-python
|
|
45
44
|
|
|
46
|
-
# FastAPI Radar
|
|
45
|
+
# FastAPI Radar
|
|
47
46
|
|
|
48
47
|
[](https://www.python.org/downloads/)
|
|
49
48
|
[](https://opensource.org/licenses/MIT)
|
|
50
49
|
|
|
51
50
|
**A debugging dashboard for FastAPI applications providing real-time request, database query, and exception monitoring.**
|
|
52
51
|
|
|
53
|
-
|
|
52
|
+
**Just one line to add powerful monitoring to your FastAPI app!**
|
|
54
53
|
|
|
55
|
-
##
|
|
54
|
+
## See it in Action
|
|
56
55
|
|
|
57
56
|

|
|
58
57
|
|
|
@@ -76,6 +75,8 @@ pipenv install fastapi-radar
|
|
|
76
75
|
|
|
77
76
|
## Quick Start
|
|
78
77
|
|
|
78
|
+
### With SQL Database (Full Monitoring)
|
|
79
|
+
|
|
79
80
|
```python
|
|
80
81
|
from fastapi import FastAPI
|
|
81
82
|
from fastapi_radar import Radar
|
|
@@ -84,7 +85,7 @@ from sqlalchemy import create_engine
|
|
|
84
85
|
app = FastAPI()
|
|
85
86
|
engine = create_engine("sqlite:///./app.db")
|
|
86
87
|
|
|
87
|
-
#
|
|
88
|
+
# Full monitoring with SQL query tracking
|
|
88
89
|
radar = Radar(app, db_engine=engine)
|
|
89
90
|
radar.create_tables()
|
|
90
91
|
|
|
@@ -94,31 +95,62 @@ async def get_users():
|
|
|
94
95
|
return {"users": []}
|
|
95
96
|
```
|
|
96
97
|
|
|
98
|
+
### Without SQL Database (HTTP & Exception Monitoring)
|
|
99
|
+
|
|
100
|
+
```python
|
|
101
|
+
from fastapi import FastAPI
|
|
102
|
+
from fastapi_radar import Radar
|
|
103
|
+
|
|
104
|
+
app = FastAPI()
|
|
105
|
+
|
|
106
|
+
# Monitor HTTP requests and exceptions only
|
|
107
|
+
# Perfect for NoSQL databases, external APIs, or database-less apps
|
|
108
|
+
radar = Radar(app) # No db_engine parameter needed!
|
|
109
|
+
radar.create_tables()
|
|
110
|
+
|
|
111
|
+
@app.get("/api/data")
|
|
112
|
+
async def get_data():
|
|
113
|
+
# Your MongoDB, Redis, or external API calls here
|
|
114
|
+
return {"data": []}
|
|
115
|
+
```
|
|
116
|
+
|
|
97
117
|
Access your dashboard at: **http://localhost:8000/\_\_radar/**
|
|
98
118
|
|
|
99
119
|
## Features
|
|
100
120
|
|
|
101
|
-
-
|
|
102
|
-
-
|
|
103
|
-
-
|
|
104
|
-
-
|
|
105
|
-
-
|
|
106
|
-
-
|
|
121
|
+
- **Zero Configuration** - Works with any FastAPI app (SQL database optional)
|
|
122
|
+
- **Request Monitoring** - Complete HTTP request/response capture with timing
|
|
123
|
+
- **Database Monitoring** - SQL query logging with execution times (when using SQLAlchemy)
|
|
124
|
+
- **Exception Tracking** - Automatic exception capture with stack traces
|
|
125
|
+
- **Real-time Updates** - Live dashboard updates as requests happen
|
|
126
|
+
- **Flexible Integration** - Use with SQL, NoSQL, or no database at all
|
|
107
127
|
|
|
108
128
|
## Configuration
|
|
109
129
|
|
|
110
130
|
```python
|
|
111
131
|
radar = Radar(
|
|
112
132
|
app,
|
|
113
|
-
db_engine=engine,
|
|
114
|
-
dashboard_path="/__radar",
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
133
|
+
db_engine=engine, # Optional: SQLAlchemy engine for SQL query monitoring
|
|
134
|
+
dashboard_path="/__radar", # Custom dashboard path (default: "/__radar")
|
|
135
|
+
max_requests=1000, # Max requests to store (default: 1000)
|
|
136
|
+
retention_hours=24, # Data retention period (default: 24)
|
|
137
|
+
slow_query_threshold=100, # Mark queries slower than this as slow (ms)
|
|
138
|
+
capture_sql_bindings=True, # Capture SQL query parameters
|
|
139
|
+
exclude_paths=["/health"], # Paths to exclude from monitoring
|
|
140
|
+
theme="auto", # Dashboard theme: "light", "dark", or "auto"
|
|
119
141
|
)
|
|
120
142
|
```
|
|
121
143
|
|
|
144
|
+
## What Gets Captured?
|
|
145
|
+
|
|
146
|
+
- ✅ HTTP requests and responses
|
|
147
|
+
- ✅ Response times and performance metrics
|
|
148
|
+
- ✅ SQL queries with execution times
|
|
149
|
+
- ✅ Query parameters and bindings
|
|
150
|
+
- ✅ Slow query detection
|
|
151
|
+
- ✅ Exceptions with stack traces
|
|
152
|
+
- ✅ Request/response bodies and headers
|
|
153
|
+
|
|
122
154
|
## Contributing
|
|
123
155
|
|
|
124
156
|
We welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) for details.
|
|
@@ -150,10 +182,14 @@ npm run dev # For development with hot reload
|
|
|
150
182
|
npm run build # To rebuild the production bundle
|
|
151
183
|
```
|
|
152
184
|
|
|
153
|
-
4. Run the example
|
|
185
|
+
4. Run the example apps:
|
|
154
186
|
|
|
155
187
|
```bash
|
|
188
|
+
# Example with SQL database
|
|
156
189
|
python example_app.py
|
|
190
|
+
|
|
191
|
+
# Example without SQL database (NoSQL/in-memory)
|
|
192
|
+
python example_nosql_app.py
|
|
157
193
|
```
|
|
158
194
|
|
|
159
195
|
## License
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "fastapi-radar"
|
|
3
|
-
version = "0.1.
|
|
3
|
+
version = "0.1.5"
|
|
4
4
|
description = "A debugging dashboard for FastAPI applications with real-time monitoring"
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
requires-python = ">=3.8"
|
|
@@ -31,8 +31,6 @@ dependencies = [
|
|
|
31
31
|
"sqlalchemy>=1.4.0",
|
|
32
32
|
"pydantic>=1.8.0",
|
|
33
33
|
"starlette>=0.14.2",
|
|
34
|
-
"black>=24.8.0",
|
|
35
|
-
"httpx>=0.28.1",
|
|
36
34
|
]
|
|
37
35
|
|
|
38
36
|
[project.urls]
|
|
@@ -49,6 +47,7 @@ dev = [
|
|
|
49
47
|
"isort>=5.10.0",
|
|
50
48
|
"flake8>=4.0.0",
|
|
51
49
|
"mypy>=0.950",
|
|
50
|
+
"httpx>=0.28.1",
|
|
52
51
|
]
|
|
53
52
|
|
|
54
53
|
[build-system]
|
|
@@ -9,7 +9,7 @@ long_description = (this_directory / "README.md").read_text()
|
|
|
9
9
|
|
|
10
10
|
setup(
|
|
11
11
|
name="fastapi-radar",
|
|
12
|
-
version="0.1.
|
|
12
|
+
version="0.1.5",
|
|
13
13
|
author="Arif Dogan",
|
|
14
14
|
author_email="me@arif.sh",
|
|
15
15
|
description="A debugging dashboard for FastAPI applications with real-time request, database query, and exception monitoring",
|
fastapi_radar-0.1.3/README.md
DELETED
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
# FastAPI Radar 🛰️
|
|
2
|
-
|
|
3
|
-
[](https://www.python.org/downloads/)
|
|
4
|
-
[](https://opensource.org/licenses/MIT)
|
|
5
|
-
|
|
6
|
-
**A debugging dashboard for FastAPI applications providing real-time request, database query, and exception monitoring.**
|
|
7
|
-
|
|
8
|
-
✨ **Just one line to add powerful monitoring to your FastAPI app!**
|
|
9
|
-
|
|
10
|
-
## 🎯 See it in Action
|
|
11
|
-
|
|
12
|
-

|
|
13
|
-
|
|
14
|
-
## Installation
|
|
15
|
-
|
|
16
|
-
```bash
|
|
17
|
-
pip install fastapi-radar
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
Or with your favorite package manager:
|
|
21
|
-
|
|
22
|
-
```bash
|
|
23
|
-
# Using poetry
|
|
24
|
-
poetry add fastapi-radar
|
|
25
|
-
|
|
26
|
-
# Using pipenv
|
|
27
|
-
pipenv install fastapi-radar
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
**Note:** The dashboard comes pre-built! No need to build anything - just install and use.
|
|
31
|
-
|
|
32
|
-
## Quick Start
|
|
33
|
-
|
|
34
|
-
```python
|
|
35
|
-
from fastapi import FastAPI
|
|
36
|
-
from fastapi_radar import Radar
|
|
37
|
-
from sqlalchemy import create_engine
|
|
38
|
-
|
|
39
|
-
app = FastAPI()
|
|
40
|
-
engine = create_engine("sqlite:///./app.db")
|
|
41
|
-
|
|
42
|
-
# That's it! One line to add complete monitoring 🚀
|
|
43
|
-
radar = Radar(app, db_engine=engine)
|
|
44
|
-
radar.create_tables()
|
|
45
|
-
|
|
46
|
-
# Your routes work unchanged
|
|
47
|
-
@app.get("/users")
|
|
48
|
-
async def get_users():
|
|
49
|
-
return {"users": []}
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
Access your dashboard at: **http://localhost:8000/\_\_radar/**
|
|
53
|
-
|
|
54
|
-
## Features
|
|
55
|
-
|
|
56
|
-
- 🚀 **Zero Configuration** - Works with any FastAPI + SQLAlchemy app
|
|
57
|
-
- 📊 **Request Monitoring** - Complete HTTP request/response capture with timing
|
|
58
|
-
- 🗃️ **Database Monitoring** - SQL query logging with execution times
|
|
59
|
-
- 🐛 **Exception Tracking** - Automatic exception capture with stack traces
|
|
60
|
-
- ⚡ **Real-time Updates** - Live dashboard updates as requests happen
|
|
61
|
-
- 🎨 **Beautiful UI** - Modern React dashboard with shadcn/ui components
|
|
62
|
-
|
|
63
|
-
## Configuration
|
|
64
|
-
|
|
65
|
-
```python
|
|
66
|
-
radar = Radar(
|
|
67
|
-
app,
|
|
68
|
-
db_engine=engine,
|
|
69
|
-
dashboard_path="/__radar", # Custom dashboard path
|
|
70
|
-
enable_in_production=False, # Disable in production
|
|
71
|
-
capture_body=True, # Capture request/response bodies
|
|
72
|
-
capture_headers=True, # Capture headers
|
|
73
|
-
max_body_size=10000, # Max body size to capture
|
|
74
|
-
)
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
## Contributing
|
|
78
|
-
|
|
79
|
-
We welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) for details.
|
|
80
|
-
|
|
81
|
-
### Development Setup
|
|
82
|
-
|
|
83
|
-
For contributors who want to modify the codebase:
|
|
84
|
-
|
|
85
|
-
1. Clone the repository:
|
|
86
|
-
|
|
87
|
-
```bash
|
|
88
|
-
git clone https://github.com/doganarif/fastapi-radar.git
|
|
89
|
-
cd fastapi-radar
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
2. Install development dependencies:
|
|
93
|
-
|
|
94
|
-
```bash
|
|
95
|
-
pip install -e ".[dev]"
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
3. (Optional) If modifying the dashboard UI:
|
|
99
|
-
|
|
100
|
-
```bash
|
|
101
|
-
cd fastapi_radar/dashboard
|
|
102
|
-
npm install
|
|
103
|
-
npm run dev # For development with hot reload
|
|
104
|
-
# or
|
|
105
|
-
npm run build # To rebuild the production bundle
|
|
106
|
-
```
|
|
107
|
-
|
|
108
|
-
4. Run the example app:
|
|
109
|
-
|
|
110
|
-
```bash
|
|
111
|
-
python example_app.py
|
|
112
|
-
```
|
|
113
|
-
|
|
114
|
-
## License
|
|
115
|
-
|
|
116
|
-
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
117
|
-
|
|
118
|
-
## Acknowledgments
|
|
119
|
-
|
|
120
|
-
- Built with [FastAPI](https://fastapi.tiangolo.com/)
|
|
121
|
-
- Dashboard powered by [React](https://react.dev/) and [shadcn/ui](https://ui.shadcn.com/)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{fastapi_radar-0.1.3 → fastapi_radar-0.1.5}/fastapi_radar/dashboard/dist/assets/index-CxIRSjZZ.js
RENAMED
|
File without changes
|
{fastapi_radar-0.1.3 → fastapi_radar-0.1.5}/fastapi_radar/dashboard/dist/assets/index-DCxkDBhr.css
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|