No project description provided
Project description
Weni Profilers
The weni-profilers
library allows you to add a simple profiler to a Django project to analyze the performance of views.
Setup in project
1. Install weni-profilers
pip install weni-profilers
2. Configure the middleware
MIDDLEWARE = [
# ...
'weni.profilers.CProfilerMiddleware',
]
Variables
USE_PROFILER = True
PROFILER_AUTH_TOKEN = "your-secret-key"
Name | Description |
---|---|
USE_PROFILER | This variable enables the profiler if it is True |
PROFILER_AUTH_TOKEN | Based on this variable, the middleware will authenticate the request |
It is recommended that both are configured by environment variables, mainly
PROFILER_AUTH_TOKEN
Using
To profile a view, add ?prof
to the URL of the view you want to analyze:
http://localhost:8000/your-view/?prof
You can pass the following parameters in the URL to customize the output:
?sort
: Sorts the output by a specific metric. The default is "team". See the official documentation for all ordering options.?count
: Defines the number of lines to be displayed. The default is 100.?download
: Downloads the profile file for viewing in tools such as SnakeViz or RunSnakeRun.
Example URL with parameters:
http://localhost:8000/your-view/?prof&sort=cumulative&count=50&download
This repository is a fork of https://github.com/omarish/django-cprofile-middleware
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
weni_profilers-0.0.2.tar.gz
(3.1 kB
view details)
Built Distribution
File details
Details for the file weni_profilers-0.0.2.tar.gz
.
File metadata
- Download URL: weni_profilers-0.0.2.tar.gz
- Upload date:
- Size: 3.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.6.1 CPython/3.10.12 Linux/6.2.0-33-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5ec613758de1a3efca31bdfec9a13301dec981979a22f9b1ce781be196aae39d |
|
MD5 | 0790e55c0fe2d90b1f1ab76aea374dd9 |
|
BLAKE2b-256 | 00ebee8fa79d88e83c4d3acc9d3dc06da59a804105cb20bce70b77caf1cedc34 |
File details
Details for the file weni_profilers-0.0.2-py3-none-any.whl
.
File metadata
- Download URL: weni_profilers-0.0.2-py3-none-any.whl
- Upload date:
- Size: 4.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.6.1 CPython/3.10.12 Linux/6.2.0-33-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3fe753b232f0beaadec23bcc1b08a4bb770e0a64ab25ea669c29bdddbbbe3d2e |
|
MD5 | 9597fee86019a6ca8c3bb4c135165475 |
|
BLAKE2b-256 | 89993abfea7f9e92d514ba7e9d5db53d97ae13dc4a1f6a93921b2783a6fe84d3 |