Skip to main content

Aiogram Based Metrics Collection for Prometheus

Project description

Aiogram Prometheus Collector

Aiogram Based Metrics Collection for Prometheus

PyPI PyPI - Python Version Docs

Downloads GitLab stars GitLab last commit

Functionality

  • Monitoring the status of bots and dispatchers
  • Middleware for monitoring the bot's network activity
  • Middleware for monitoring the event handler performance

example

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aiogram_prometheus-0.3.1.tar.gz (10.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

aiogram_prometheus-0.3.1-py3-none-any.whl (12.2 kB view details)

Uploaded Python 3

File details

Details for the file aiogram_prometheus-0.3.1.tar.gz.

File metadata

  • Download URL: aiogram_prometheus-0.3.1.tar.gz
  • Upload date:
  • Size: 10.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.2 {"installer":{"name":"uv","version":"0.10.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for aiogram_prometheus-0.3.1.tar.gz
Algorithm Hash digest
SHA256 938cf975da48c539bf45da08e57106322719b7ff5fe7abd450fe4272a9ed5e7e
MD5 19ca3d9dfe8126f432316faaf8f6be21
BLAKE2b-256 07ab23fb82879bd76f7d11aa5adb9702ec1ff4d431e928164439cde5e03235be

See more details on using hashes here.

File details

Details for the file aiogram_prometheus-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: aiogram_prometheus-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 12.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.2 {"installer":{"name":"uv","version":"0.10.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for aiogram_prometheus-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 576f3ff8f8794bc19eae7c83e4da44c9deb7f56080b39ac767a513495916724f
MD5 e4a9e6eadd1e1f49a5ad1c107842787f
BLAKE2b-256 2fae6ae53d11b4f63a6f9040ed79c3fe1aff65e7141b4d52d782d78a799b1901

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page