Skip to main content

Utils fot prometheus-client

Project description

Utils for prometheus-client

Poetry plugin to set package version based on git tag.

PyPI PyPI - Python Version GitLab last commit

Test coverage Downloads GitLab stars

Functionality

  • Push clients
    • pushgateway
    • statsd

Installation

pip install prometheus-client-utils

Collectors

AsyncioCollector

from prometheus_client import REGISTRY
from prometheus_client_utils.collectors import AsyncioCollector

collector = AsyncioCollector()
REGISTRY.register(self.collector)

Push clients

PushGatewayClient

import asyncio
from random import randint

from prometheus_client import REGISTRY, Counter, Histogram

from prometheus_client_utils.collectors import AsyncioCollector
from prometheus_client_utils.push_clients import PushGatewayClient

m_count = Counter('iters', 'count')
m_histogram = Histogram('iters_time', 'histogram')

semaphore = asyncio.Semaphore(50)


@m_histogram.time()
async def inner():
    async with semaphore:
        m_count.inc()
        await asyncio.sleep(randint(0, 10))


async def main():
    loop = asyncio.get_running_loop()

    REGISTRY.register(AsyncioCollector(loop))

    push_client = PushGatewayClient('localhost', 'test')
    push_client.schedule_push(5, loop)

    for i in range(10000):
        await asyncio.sleep(i / 100)
        loop.create_task(inner())


if __name__ == '__main__':
    asyncio.run(main())

Contribute

Issue Tracker: https://gitlab.com/rocshers/python/poetry-git-version-plugin/-/issues
Source Code: https://gitlab.com/rocshers/python/poetry-git-version-plugin

Before adding changes:

make install-dev

After changes:

make format test

Download files

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

Source Distribution

prometheus_client_utils-0.1.3.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

prometheus_client_utils-0.1.3-py3-none-any.whl (6.6 kB view details)

Uploaded Python 3

File details

Details for the file prometheus_client_utils-0.1.3.tar.gz.

File metadata

  • Download URL: prometheus_client_utils-0.1.3.tar.gz
  • Upload date:
  • Size: 4.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.6.1 CPython/3.8.18 Linux/5.15.0-88-generic

File hashes

Hashes for prometheus_client_utils-0.1.3.tar.gz
Algorithm Hash digest
SHA256 c2f4e02b0c90ab72cc99075d5fcd2fc3a852e0560f77f41c51e73af8a5ffeb52
MD5 1947f30fcbe2b3ec0f5610b225e041ef
BLAKE2b-256 57cdd2a4a85569d30cf123540f47fc4016079fa0f75f63cffb0e7eefa3369750

See more details on using hashes here.

File details

Details for the file prometheus_client_utils-0.1.3-py3-none-any.whl.

File metadata

File hashes

Hashes for prometheus_client_utils-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 b5dc4579ddf9520861051e35da4d2827fa59bf09786ff19e50d1b3898561db53
MD5 d994dc81606fe874c6568527bcb668c1
BLAKE2b-256 f4664c13f57ad2d8a2dc4f4ef985e5a013b404ef742be3503b2fade65a6575e5

See more details on using hashes here.

Supported by

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