Skip to main content

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.

Metadata

Release files for Flask-Performance 0.0.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for Flask-Performance 0.0.6
File Size Uploaded
Flask-Performance-0.0.6.tar.gz 2.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for Flask-Performance 0.0.6
File Interpreter ABI Platform
Flask_Performance-0.0.6-py3-none-any.whl Python 3 none any Details

Total release size: 6.9 kB

Release files / Flask-Performance-0.0.6.tar.gz

Download URL Flask-Performance-0.0.6.tar.gz
Size 2.7 kB
Tags Source
SHA-256 checksum
How to use checksums
81843d60b608742d826585cc548cf1ad668894fd2b097721373dd6af405358c2
BLAKE2b-256 checksum
How to use checksums
73972b85322214fc44c408426641dc3d1049abd8159d456fe6e3ee76c708f18d
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / Flask_Performance-0.0.6-py3-none-any.whl

Download URL Flask_Performance-0.0.6-py3-none-any.whl
Size 4.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
79990f5ddc2f9335337e815e01c63085211aa2e8598a2fa32e0ef44d2dbc340f
BLAKE2b-256 checksum
How to use checksums
9ab020c60117715273273b2336d4023b3aa9d72c3453d352470f2de8ceca1419
Upload date
Uploaded using Trusted Publishing?
What is 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

Release history Release notifications | RSS feed

This release

0.0.6 This release

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page