Skip to main content

A Flask extension to monitoring every REAL api request and collect it's performance in REAL-time.

Project description

Flask-Performance

A Flask extension to monitoring every REAL api request and collect it's performance in REAL-time.

1、Install by pip

pip install flask-performance

2、Generate DSN

Go to https://status.spacebox.fun, sign up or login. Create a new project or new team (if you are working in a company, we highly recommend you create Team first and put every project into the Team afterward)

And after suceccfully create a project, you are given a DSN url, which is the API your project performance data will send to.

e.g.

https://metrics.spacebox.fun/v1/collector/c5b35bc078844a59a15dd506e08f3ae6

3、Setup & configuration in your Flask project

from flask import Flask
from flask_performance import PerformanceCollector

app = Flask(__name__)
app.config['METRIC_DSN'] = 'https://metrics.spacebox.fun/v1/collector/c5b35bc078844a59a15dd506e08f3ae6'

pc = PerformanceCollector(app)

# or by init_app() when you use factory pattern to creat flask app
app = create_app()
app.config['METRIC_DSN'] = 'https://metrics.spacebox.fun/v1/collector/c5b35bc078844a59a15dd506e08f3ae6'

pc = PerformanceCollector()
pc.init_app(app)

You can also put METRIC_DSN into your project config.py file and use Flask's from_pyfile.

in your config.py file

METRIC_DSN = 'https://metrics.spacebox.fun/v1/collector/c5b35bc078844a59a15dd506e08f3ae6'

in your project app.py file

app.from_pyfile('config')

And, That's ALL, just go to your https://status.spacebox.fun platform to check your project all API performance in real-time.

4、Performance problem

Chance is that you will ask: Will this performance collector affect your project's performance ?

the short answer is: yes.

BUT, the affects is limit maximus to 500ms. We set the timeout to 500ms when send the performance data to the API.

And we implemented this API in a asynchronous way, which means when we receive your project performance data every time we will response immediately and throw the save performance data task to a task queue (which is Celery). In most case, the API will reponse under 100ms.

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

Flask-Performance-0.0.5.tar.gz (2.7 kB view details)

Uploaded Source

Built Distribution

Flask_Performance-0.0.5-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

Details for the file Flask-Performance-0.0.5.tar.gz.

File metadata

  • Download URL: Flask-Performance-0.0.5.tar.gz
  • Upload date:
  • Size: 2.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.7

File hashes

Hashes for Flask-Performance-0.0.5.tar.gz
Algorithm Hash digest
SHA256 2dcd77d0c932132d8579f536f213b703414836d3b43559febb2dabd30f8d2982
MD5 4d03160fd5f2b190eb75843b10f86014
BLAKE2b-256 cbb0235cd7f45cea1b1988437c5524bcffd3b9f4924a44529987847106ae98c7

See more details on using hashes here.

File details

Details for the file Flask_Performance-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: Flask_Performance-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 4.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.7

File hashes

Hashes for Flask_Performance-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 a072db4323157fe76e75b5f97a836bf65544e4688404c9a765f6da8da88b8815
MD5 9591fe29a1a005e4438a70b096a8379d
BLAKE2b-256 f0360397a3b37943af5e7035ba390934483e140e07fab40326ca698675c134d3

See more details on using hashes here.

Supported by

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