aka-stats-21.2.5
توضیحات
Module for keeping metrics about your application in Redis. The goal is to have an easy way to measure an application, and then expose these metrics through a HTTP API, either to process it in some web ui, or expose it to Prometheus.
| ویژگی | مقدار |
|---|---|
| سیستم عامل | - |
| نام فایل | aka-stats-21.2.5 |
| نام | aka-stats |
| نسخه کتابخانه | 21.2.5 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | Michal Mazurek |
| ایمیل نویسنده | mazurek.michal@gmail.com |
| آدرس صفحه اصلی | https://github.com/MichalMazurek/aka_stats |
| آدرس اینترنتی | https://pypi.org/project/aka-stats/ |
| مجوز | MIT |
# Aka Stats
[](https://github.com/MichalMazurek/aka_stats/blob/main/LICENSE)
[](https://github.com/MichalMazurek/aka_stats/actions?query=workflow%3A%22Test+code%22)
[](https://pypi.org/project/aka-stats/)
Aka (赤 - red in japanese) Stats.
Unified module for keeping stats in Redis.
The goal is to have an easy way to measure an application, and then expose these metrics through a HTTP API,
either to process it in some web ui, or expose it to Prometheus.
```python
from aka_stats import Stats, timer
with Stats() as stats:
t = timer()
...
stats("task_done", next(t).stat)
```
Or for asynchronouse code:
```python
from aka_stats import Stats, timer
async def process_device(device_id: str):
async with Stats() as stat:
t = timer()
...
stats("task_done", next(t).stat, extra_labels={"device_id": device_id})
```
## Installation
And add this package to your project:
```bash
poetry add aka-stats
```
## Usage Guide
Check out the usage guide here: [Usage.md](Usage.md)
## Prometheus formatters
Information how to write a formatter is here: [PrometheusFormatter.md](PrometheusFormatter.md)
## Optional Standalone HTTP API
Check out this guide here: [Included HTTP API](<Included http api.md>)
## Pytest plugin
This module is also a pytest plugin, providing a fixture `mock_stats` which collects stats instead of writing them
to Redis.
```python
def test_something(mock_stats):
do_something()
assert mock_stats[0] == (1612550961, "test", 1, None)
```
And the module with function:
```python
def do_something():
with Stats() as stats:
stat("test", 1)
```
نیازمندی
| مقدار | نام |
|---|---|
| >=3.4.1,<4.0.0 | redis |
| >=1.3.1,<2.0.0 | aioredis |
| >=2019.3,<2020.0 | pytz |
| >=0.54.1,<0.55.0) | fastapi |
زبان مورد نیاز
| مقدار | نام |
|---|---|
| >=3.7,<4.0 | Python |
نحوه نصب
نصب پکیج whl aka-stats-21.2.5:
pip install aka-stats-21.2.5.whl
نصب پکیج tar.gz aka-stats-21.2.5:
pip install aka-stats-21.2.5.tar.gz