Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

aiogram-prometheus

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

aiogram-prometheus

Aiogram Based Metrics Collection for Prometheus

  • 0.3.0
  • PyPI
  • Socket score

Maintainers
1

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

Keywords

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc