Skip to main content
Archived

This project has been archived by its maintainers, and is no longer receiving any updates.

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

Metadata

Release files for prometheus-client-utils 0.1.3

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

Source distribution (sdist)

Source distribution for prometheus-client-utils 0.1.3
File Size Uploaded
prometheus_client_utils-0.1.3.tar.gz 4.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for prometheus-client-utils 0.1.3
File Interpreter ABI Platform
prometheus_client_utils-0.1.3-py3-none-any.whl Python 3 none any Details

Total release size: 11.1 kB

Release files / prometheus_client_utils-0.1.3.tar.gz

Download URL prometheus_client_utils-0.1.3.tar.gz
Size 4.5 kB
Tags Source
SHA-256 checksum
How to use checksums
c2f4e02b0c90ab72cc99075d5fcd2fc3a852e0560f77f41c51e73af8a5ffeb52
BLAKE2b-256 checksum
How to use checksums
57cdd2a4a85569d30cf123540f47fc4016079fa0f75f63cffb0e7eefa3369750
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.6.1 CPython/3.8.18 Linux/5.15.0-88-generic

Release files / prometheus_client_utils-0.1.3-py3-none-any.whl

Download URL prometheus_client_utils-0.1.3-py3-none-any.whl
Size 6.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b5dc4579ddf9520861051e35da4d2827fa59bf09786ff19e50d1b3898561db53
BLAKE2b-256 checksum
How to use checksums
f4664c13f57ad2d8a2dc4f4ef985e5a013b404ef742be3503b2fade65a6575e5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.6.1 CPython/3.8.18 Linux/5.15.0-88-generic

Release history Release notifications | RSS feed

This release

0.1.3 This release

2 release files

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