fastapi-cprofile-0.0.2
توضیحات
A FastAPI Middleware with cProfile to stats your service performance.
| ویژگی | مقدار |
|---|---|
| سیستم عامل | OS Independent |
| نام فایل | fastapi-cprofile-0.0.2 |
| نام | fastapi-cprofile |
| نسخه کتابخانه | 0.0.2 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | jijunlx |
| ایمیل نویسنده | jijunlx@gmail.com |
| آدرس صفحه اصلی | https://github.com/Jijun/fastapi-cprofile.git |
| آدرس اینترنتی | https://pypi.org/project/fastapi-cprofile/ |
| مجوز | MIT |
# fastapi-cprofile
A FastAPI Middleware with cProfile to help stats your service performance.
cProfile is a built-in python module that can perform profiling. It is the most commonly used profiler currently.
# Features
- [x] support custom cprofile param
#Installation
```buildoutcfg
$ pip install fastapi-cprofile
```
# Code Sample
```python
from fastapi_cprofile.profiler import CProfileMiddleware
app = FastAPI()
app.add_middleware(CProfileMiddleware)
```
add cprofile options
```python
from fastapi_cprofile.profiler import CProfileMiddleware
app = FastAPI()
app.add_middleware(CProfileMiddleware, enable=True, print_each_request = True, strip_dirs = False, sort_by='cumulative')
```
or dump out file while shutdown your app then you can use gprof2dot [gprof2dot](https://github.com/jrfonseca/gprof2dot) to view it.
```python
from fastapi_cprofile.profiler import CProfileMiddleware
app = FastAPI()
app.add_middleware(CProfileMiddleware, enable=True, server_app = app, filename='/tmp/output.pstats', strip_dirs = False, sort_by='cumulative')
```
# License
MIT
نیازمندی
| مقدار | نام |
|---|---|
| - | fastapi |
نحوه نصب
نصب پکیج whl fastapi-cprofile-0.0.2:
pip install fastapi-cprofile-0.0.2.whl
نصب پکیج tar.gz fastapi-cprofile-0.0.2:
pip install fastapi-cprofile-0.0.2.tar.gz