Skip to main content

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


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.1.tar.gz (7.4 kB view details)

Uploaded Source

Built Distribution

readme_metrics-1.0.1-py3-none-any.whl (15.8 kB view details)

Uploaded Python 3

File details

Details for the file readme-metrics-1.0.1.tar.gz.

File metadata

  • Download URL: readme-metrics-1.0.1.tar.gz
  • Upload date:
  • Size: 7.4 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

Hashes for readme-metrics-1.0.1.tar.gz
Algorithm Hash digest
SHA256 2222ef071db35ede83a29ab78202a09322a8d4d1c500d108a22f99fe3a7363bf
MD5 4d0e8665863957f541b7a9352db801b3
BLAKE2b-256 9ab33269d911980e602fd213b9aba8f50248150edc8aeb0a3397ca0b7fb80a8a

See more details on using hashes here.

File details

Details for the file readme_metrics-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: readme_metrics-1.0.1-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

Hashes for readme_metrics-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 bea3a9e0a5b067864b206bea4342b9891367b23e731fd327bdd048aa769f0a9a
MD5 c0166f5571b353cd58d9db3d4b30ca1c
BLAKE2b-256 bdfe5cea5c34dea980cacab5780a391421b1d1264c41620c986ad4aa329e5034

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page