Skip to main content

flask-stats

Flask-stats is a simple plugin that allows you to have important information and statistics for the endpoints that you have. It collects all the data and then you can access it through endpoints live. This plug-in allows to monitor simple api without the necessity of any payment, such as new relic

Status: working progress

Instalation

pip install flask-api-stats

A Simple Example

from flask import Flask
from time import sleep
from flask_stats.flask_stats import Stats

app = Flask(__name__)
Stats(app)

@app.route('/')
def hello():
    sleep(10)
    return 'Hello World!'

if __name__ == '__main__':
    app.run()

Adding Stats(app) allows to register statistics of the API such as response time or configuration.

In any time, we can enter in /endpoints_stats to see duration of each endpoint

{
    duration: [
        {
            endpoint "/" : {
                avg: 10.009691333770752,
                count: 5,
                max: 10.010810375213623,
                min: 10.007489919662476,
                percentile_25: 10.007489919662476,
                percentile_50: 10.01064133644104,
                percentile_75: 10.010623693466187,
                percentile_90: 10.010810375213623
            }
        },
    ...
    ]
}

Other endpoint is /stats where we can see uptime, gc_stats and other configurations

{
gc_stats: {
    gc.get_debug: 0,
    gc.get_stats: {
        collected: 5455,
        collections: 130,
        uncollectable: 0
    ...
    },
    uptime: 1210.0311439037323,
    uptime_readable: {
        days: 0,
        hours: 0,
        minutes: 20,
        seconds: 10.0311439037323
    }
}

Contact

Please if you have any doubt or found any bug report and issue or send an email to fernando.bugni(a)gmail.com

Metadata

Release files for flask-api-stats 0.5

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-api-stats 0.5
File Size Uploaded
flask-api-stats-0.5.tar.gz 6.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for flask-api-stats 0.5
File Interpreter ABI Platform
flask_api_stats-0.5-py3-none-any.whl Python 3 none any Details

Total release size: 26.8 kB

Release files / flask-api-stats-0.5.tar.gz

Download URL flask-api-stats-0.5.tar.gz
Size 6.1 kB
Tags Source
SHA-256 checksum
How to use checksums
8a1ee9e05cfd5b0453f4d73100a773dbe57414bdf7b5f4ccab666bccce7f3fdb
BLAKE2b-256 checksum
How to use checksums
43cb2c880cecf6f4905b6e2f8e1b4957660399bd987020121803979ab3a39352
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_api_stats-0.5-py3-none-any.whl

Download URL flask_api_stats-0.5-py3-none-any.whl
Size 20.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e65952262063ada54b82839bf20dffbd07d57bbb47ea19ec919d8e9a0abe926c
BLAKE2b-256 checksum
How to use checksums
69bd66e52760a6bf57668895254c131a1f8e0e27d2f33b437925fd7c42e02f97
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.5 This release

2 release files

0.4

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