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
- support custom cprofile param
#Installation
$ pip install fastapi-cprofile
Code Sample
from fastapi_cprofile.profiler import CProfileMiddleware
app = FastAPI()
app.add_middleware(CProfileMiddleware)
add cprofile options
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 to view it.
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
Metadata
Release files for fastapi-cprofile 0.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| fastapi_cprofile-0.0.2.tar.gz | 3.7 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| fastapi_cprofile-0.0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 7.7 kB
Release files / fastapi_cprofile-0.0.2.tar.gz
| Download URL | fastapi_cprofile-0.0.2.tar.gz |
|---|---|
| Size | 3.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
af929b6c48add45b36c68a22efc1b699f86317e7d3d52623d52589228a764d5e
|
|
BLAKE2b-256 checksum How to use checksums |
0d7734a599a7093a877b944871acbdaf6d20a76a62e2e58bddefad8041d4a86a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.0.0.post20201207 requests-toolbelt/0.9.1 tqdm/4.55.0 CPython/3.8.5
|
Release files / fastapi_cprofile-0.0.2-py3-none-any.whl
| Download URL | fastapi_cprofile-0.0.2-py3-none-any.whl |
|---|---|
| Size | 4.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
dc2709c54a9503915d7f1fa9a81c38c9405762440421a22d131d78c3461cdb08
|
|
BLAKE2b-256 checksum How to use checksums |
e4bdeae21674702e5e4bd942798c5020139e59c299265a27061b318c1ee14d9a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.0.0.post20201207 requests-toolbelt/0.9.1 tqdm/4.55.0 CPython/3.8.5
|
Security for fastapi-cprofile 0.0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.