Skip to main content

simple metrics for your app

Project description

ci codecov PyPI version PyPI - Python Version Code style: black

async_metrics

asyncio metrics for your app.

Available metrics:

  • asyncio: event loop status, policy and exception handler and tasks info;
  • system: uptime, platform, recursion limit, default encoding, phisical and virtual processors, system load and process user;
  • dependencies: application dependencies;
  • python: implementation, version and PATH;
  • process: application process info like: threads, open files, connections, context switch and childrens PID;
  • partitions: partitions usage;
  • about: async_metrics version, project: url, issues and release pages.

dashboard

Installation

Install and update using pip:

pip install -U async_metrics

Usage

AIOHTTP

from aiohttp import web
from async_metrics.ext.aiohttp import setup_async_metrics


app = web.Application()
setup_async_metrics(app)

web.run_app(app, host="0.0.0.0")

Flask

from flask import Flask
from async_metrics.ext.flask import setup_async_metrics

app = Flask(__name__)
setup_async_metrics(app)

@app.route('/')
def hello_world():
    return 'Hello, World!'

Examples

Clone the repository, install the dependencies and follow the following steps:

AIOHTTP

python examples/aiohttp_example.py

For web UI dashboard access:

Flask

FLASK_APP=examples/flask_example.py flask run

For web UI dashboard access:

CLI

Installation

pip install async_metrics[cli]

Usage

python -m async_metrics show -h
Usage: python -m async_metrics show [OPTIONS] [ADDRESS]

Options:
  --asyncio     Show summary information about async environmen.
  --system      Show information about system environment.
  --deps        Show applications dependencies.
  --python      Show information about current python environment.
  --process     Show summary information about application process.
  --partitions  Show summary information about disk partition.
  --about       Show information about async_metrics.
  -h, --help    Show this message and exit.

ADDRESS can be set via environment variable ASYNC_METRICS_HOST

Acessing AIOHTTP example metrics:

# default request URL: http://localhost:8080/async_metrics
python -m async_metrics show --system

Acessing Flask example metrics:

python -m async_metrics show http://localhost:5000/async_metrics --system

Links

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

async_metrics-0.1.0.tar.gz (17.4 kB view hashes)

Uploaded Source

Built Distribution

async_metrics-0.1.0-py2.py3-none-any.whl (19.1 kB view hashes)

Uploaded Python 2 Python 3

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