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 |
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.2.tar.gz
(7.5 kB
view details)
Built Distribution
File details
Details for the file readme-metrics-1.0.2.tar.gz
.
File metadata
- Download URL: readme-metrics-1.0.2.tar.gz
- Upload date:
- Size: 7.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.3.1 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
b46910d42b50ceafac5895479eea52a5495dfe4afb8f1774f8ea20181743408d
|
|
MD5 |
391e9420088ed901df2713df2fc3ed95
|
|
BLAKE2b-256 |
dbcb8062625b9f1f903597b4a4477a05afdb2ed5a5a0a1f3bd4df854b7dca8ee
|
File details
Details for the file readme_metrics-1.0.2-py3-none-any.whl
.
File metadata
- Download URL: readme_metrics-1.0.2-py3-none-any.whl
- Upload date:
- Size: 15.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/49.3.1 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
4553b2cdb4de257b88b90be3a41e51400fcb8dbdb631c56b8c8489d0be23eaa6
|
|
MD5 |
ca7d472c63427ff2df5081e4daaa7cb0
|
|
BLAKE2b-256 |
e4db73ff8cbb2252d15a090d86f2ecc548a6b023bbe1fd1b7dcb27ac66802b99
|