ReadMe API Metrics WSGI SDK
Project description
readme-metrics
Track your API metrics within ReadMe.
Installation
pip install readme-metrics
Usage
Just include the MetricsMiddleware
into your API!
from readme_metrics import MetricsApiConfig, MetricsMiddleware
app = Flask(__name__)
app.wsgi_app = MetricsMiddleware(
app.wsgi_app,
MetricsApiConfig(
README_API_KEY,
lambda req: {
'id': 'unique id of user making call',
'label': 'label for us to show for this user (ie email, project name, user name, etc)',
'email': 'email address for user'
},
)
)
Configuration Options
There are a few options you can pass in to change how the logs are sent to ReadMe. These can be passed in MetricsApiConfig
.
Ex)
MetricsApiConfig(
README_API_KEY,
lambda req: {
'id': 'unique id of user making call',
'label': 'label for us to show for this user (ie email, project name, user name, etc)',
'email': 'email address for user'
},
buffer_length=1,
blacklist=['credit_card'] # Prevents credit_card in the request from being sent to readme
)
Option | Use |
---|---|
development_mode | default: false If true, the log will be separate from normal production logs. This is great for separating staging or test data from data coming from customers |
blacklist | optional An array of keys from your API requests and responses headers and bodies that you wish to blacklist from sending to ReadMe. If you configure a blacklist, it will override any whitelist configuration. |
whitelist | optional An array of keys from your API requests and responses headers and bodies that you only wish to send to ReadMe. |
buffer_length | default: 10 Sets the number of API calls that should be recieved before the requests are sent to ReadMe |
allowed_http_hosts | A list of allowed http hosts for sending data to the ReadMe API. |
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
readme-metrics-1.0.4.tar.gz
(7.1 kB
view details)
Built Distribution
File details
Details for the file readme-metrics-1.0.4.tar.gz
.
File metadata
- Download URL: readme-metrics-1.0.4.tar.gz
- Upload date:
- Size: 7.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.7.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
ad6599109aaff68dc7422089e7070d06577e75e0eddb34465fc8cd9eb50f8c1f
|
|
MD5 |
b69308bc1622d2099779ae989378da84
|
|
BLAKE2b-256 |
ed1b9b3537ae25546c7fc95fa959352183fae3f2c799e955316722b21ce1928c
|
File details
Details for the file readme_metrics-1.0.4-py3-none-any.whl
.
File metadata
- Download URL: readme_metrics-1.0.4-py3-none-any.whl
- Upload date:
- Size: 9.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.7.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
d79a0f26d52fae8e8ed263c28c06ecb6f59940267ac6f166ad15d86df06737ba
|
|
MD5 |
7b38f0dca8da2bd1b15dd606af999611
|
|
BLAKE2b-256 |
c2fe4e3d490610c471a5f90b6ef4d7858ccd7b564b88490cd019768beeb3b490
|