Utils fot prometheus-client
Project description
Utils for prometheus-client
Poetry plugin to set package version based on git tag.
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
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
Algorithm | Hash digest | |
---|---|---|
SHA256 | c2f4e02b0c90ab72cc99075d5fcd2fc3a852e0560f77f41c51e73af8a5ffeb52 |
|
MD5 | 1947f30fcbe2b3ec0f5610b225e041ef |
|
BLAKE2b-256 | 57cdd2a4a85569d30cf123540f47fc4016079fa0f75f63cffb0e7eefa3369750 |
File details
Details for the file prometheus_client_utils-0.1.3-py3-none-any.whl
.
File metadata
- Download URL: prometheus_client_utils-0.1.3-py3-none-any.whl
- Upload date:
- Size: 6.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.6.1 CPython/3.8.18 Linux/5.15.0-88-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b5dc4579ddf9520861051e35da4d2827fa59bf09786ff19e50d1b3898561db53 |
|
MD5 | d994dc81606fe874c6568527bcb668c1 |
|
BLAKE2b-256 | f4664c13f57ad2d8a2dc4f4ef985e5a013b404ef742be3503b2fade65a6575e5 |