Aiogram Based Metrics Collection for Prometheus
Project description
Aiogram Prometheus Collector
Aiogram Based Metrics Collection for Prometheus
Functionality
- Monitoring the
status
of bots and dispatchers - Middleware for monitoring the bot's
network activity
- Middleware for monitoring the
event handler performance
Installation
pip install aiogram-prometheus
Quick start
- aiogram_prometheus.PrometheusWrapperStorage - Collecting
storage
usage metrics - aiogram_prometheus.PrometheusUpdatesMiddleware - Collecting information about dispatcher
updates
import os
import aiogram
from aiogram import Bot, Dispatcher
from aiogram.fsm.storage.memory import MemoryStorage
from aiogram_prometheus import PrometheusUpdatesMiddleware, PrometheusWrapperStorage
bot = Bot(os.environ['ENV_TG_BOT'])
dp = Dispatcher(storage=PrometheusWrapperStorage(MemoryStorage()))
dp.update.middleware(PrometheusUpdatesMiddleware())
if __name__ == '__main__':
asyncio.run(dp.start_polling(bot))
Classes
aiogram_prometheus.PrometheusWrapperStorage
A wrapper around any storage you use that will collect usage metrics
from aiogram import Bot, Dispatcher
from aiogram.fsm.storage.memory import MemoryStorage
from aiogram_prometheus import PrometheusWrapperStorage
dp = Dispatcher(storage=PrometheusWrapperStorage(MemoryStorage()))
aiogram_prometheus.PrometheusUpdatesMiddleware
Intermediate layer for collecting metrics of updates processing
from aiogram import Dispatcher
from aiogram_prometheus import PrometheusUpdatesMiddleware
dp = Dispatcher()
dp.update.middleware(PrometheusUpdatesMiddleware())
Contribute
Issue Tracker: https://gitlab.com/rocshers/python/aiogram-prometheus/-/issues
Source Code: https://gitlab.com/rocshers/python/aiogram-prometheus
Before adding changes:
make install-dev
After changes:
make format test
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file aiogram_prometheus-0.3.0.tar.gz
.
File metadata
- Download URL: aiogram_prometheus-0.3.0.tar.gz
- Upload date:
- Size: 6.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.12.4 Linux/6.8.0-40-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e42febc6b893e3f01b3e8fd2ba3d42645b11f9d49979b8681dc75a1c4f7746dd |
|
MD5 | 874cb6f90661666139544fdd04342f89 |
|
BLAKE2b-256 | fbd1342d5ac94506903637d0aada569ecff287a747dbbeddd3f89751a8c1d3ff |
File details
Details for the file aiogram_prometheus-0.3.0-py3-none-any.whl
.
File metadata
- Download URL: aiogram_prometheus-0.3.0-py3-none-any.whl
- Upload date:
- Size: 8.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.12.4 Linux/6.8.0-40-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4d27cce7b4f44c87fe8bf7cfc9a63866dbea3c9626cb6e5896c9271f586805c9 |
|
MD5 | 11182b10f2f29d5ab3892c30733e0533 |
|
BLAKE2b-256 | 1552027686765bb69b27bd4ef29c9b58accbebda5f0b7bd6ce1941802525c0ed |