Skip to main content

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

Metadata

Release files for aiogram-prometheus 0.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for aiogram-prometheus 0.3.1
File Size Uploaded Provenance Actions
aiogram_prometheus-0.3.1.tar.gz 10.3 kB Without provenance Details for aiogram_prometheus-0.3.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for aiogram-prometheus 0.3.1
File Interpreter ABI Platform Actions
aiogram_prometheus-0.3.1-py3-none-any.whl Python 3 none any Details for aiogram_prometheus-0.3.1-py3-none-any.whl

Total release size: 22.5 kB

Release files / aiogram_prometheus-0.3.1.tar.gz

Download URL aiogram_prometheus-0.3.1.tar.gz
Size 10.3 kB
Tags Source
SHA-256 checksum
How to use checksums
938cf975da48c539bf45da08e57106322719b7ff5fe7abd450fe4272a9ed5e7e
BLAKE2b-256 checksum
How to use checksums
07ab23fb82879bd76f7d11aa5adb9702ec1ff4d431e928164439cde5e03235be
Upload date
Uploaded using Trusted Publishing?
What is 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}

Release files / aiogram_prometheus-0.3.1-py3-none-any.whl

Download URL aiogram_prometheus-0.3.1-py3-none-any.whl
Size 12.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
576f3ff8f8794bc19eae7c83e4da44c9deb7f56080b39ac767a513495916724f
BLAKE2b-256 checksum
How to use checksums
2fae6ae53d11b4f63a6f9040ed79c3fe1aff65e7141b4d52d782d78a799b1901
Upload date
Uploaded using Trusted Publishing?
What is 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}

Security for aiogram-prometheus 0.3.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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