Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/openprocurement/pyramid-timing
https://github.com/openprocurement/pyramid-timing
Last synced: 17 days 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 (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-02-27T11:36:43.000Z (almost 6 years ago)
- Last Synced: 2024-11-09T11:35:48.994Z (2 months ago)
- Language: Python
- Size: 30.3 KB
- Stars: 0
- Watchers: 11
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
[![Build Status](https://travis-ci.org/openprocurement/pyramid-timing.svg?branch=master)](https://travis-ci.org/openprocurement/pyramid-timing)
[![Coverage Status](https://coveralls.io/repos/github/openprocurement/pyramid-timing/badge.svg)](https://coveralls.io/github/openprocurement/pyramid-timing)
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](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_middlewareapp = Flask(__name__)
setup_middleware(app)
```