https://github.com/openprocurement/pyramid-timing
https://github.com/openprocurement/pyramid-timing
Last synced: 12 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/openprocurement/pyramid-timing
- Owner: openprocurement
- License: apache-2.0
- Created: 2017-05-29T09:40:36.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2019-02-27T11:36:43.000Z (over 7 years ago)
- Last Synced: 2025-07-15T12:40:43.454Z (about 1 year ago)
- Language: Python
- Size: 30.3 KB
- Stars: 0
- Watchers: 10
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
[](https://travis-ci.org/openprocurement/pyramid-timing)
[](https://coveralls.io/github/openprocurement/pyramid-timing)
[](https://opensource.org/licenses/Apache-2.0)
# pyramid-timing
Timing tween for measure request process time as pyramid plugin.
Write to log `request processing time`, `request method` and `response status code` on `DEBUG` level.
### Installation
```shell
pip install pyramidtiming [flask, pyramid, test]
```
or
```shell
git clone https://github.com/openprocurement/pyramid-timing.git
cd pyramid-timing
pip install .[flask, pyramid, test]
```
### How to use
```python
from pyramid.config import Configurator
from pyramidtiming.tween import includeme as include_tween
config = Configurator()
include_tween(config)
```
For disable pyramid-timing you can remove plugin or set option `pyramid_timing = false`
`config.settings.pyramid_timing = False`
### Use as middleware
```
[pipeline:main]
pipeline = request_metrics
[filter:request_metrics]
paste.filter_factory = pyramidtiming.tween:factory
```
### Use as flask middleware via `app.before_request` and `app.after_request`
```python
from flask import Flask, request, g
from pyramidtiming.flask_middleware import setup_middleware
app = Flask(__name__)
setup_middleware(app)
```