[](https://travis-ci.org/turtlemonvh/prometheus_python_roller)
[](https://pypi.python.org/pypi/prometheus_roller)
[](https://pypi.python.org/pypi/prometheus_roller)
[](https://pypi.python.org/pypi/prometheus_roller)
[](https://pypi.python.org/pypi/prometheus_roller)
This is a small helper utility for creating time-boxed rollups for histogram and counter metrics created using the [prometheus python client](https://github.com/prometheus/client_python).
Metrics like counters and histograms increase indefinitely, but you usually care about recent activity. This library provides a way to turn a counter or histogram into a gauge or set of gauges that give instantaneous measures of the state of the application.
This isn't very useful if you're using [the prometheus server](https://github.com/prometheus/prometheus) since it provides [functions to do that for you](https://prometheus.io/docs/querying/functions/), but if you are sending metrics to multiple places (e.g. [check_mk](https://mathias-kettner.de/checkmk_localchecks.html)) and you want to send those metrics in a form that make basic alerting and reporting easier, this may help.
## Usage
```python
from prometheus_client import Histogram, Counter
from prometheus_roller import HistogramRoller, CounterRoller, start_update_daemon
# Create a histogram
h = Histogram('test_value', 'Testing roller')
# Create a counter
c = Counter('test_counted_value', 'Testing roller')
# Create a roller for the histogram, which calculates windowed values.
# By default it will create a gauge with a label for each histogram bin.
# The value of each gauge will be the change in value over the last 5 minutes, updated every 5 seconds.
# See the `options` parameter for more configuration options.
rh = HistogramRoller(h)
# Create a roller for the counter, which calculates windowed values.
# The value of each gauge will be the change in value over the last 5 minutes, updated every 5 seconds.
# See the `options` parameter for more configuration options.
rc = CounterRoller(c)
# Launch a daemon thread tracking and updating all roller objects.
# See the code for more options for configuring this update process.
start_update_daemon()
```
## Installation
```bash
# Install with pip
pip install prometheus_roller
# To install as editable to work on it
pip install -e git+https://github.com/turtlemonvh/prometheus_python_roller.git#egg=prometheus_python_roller
# OR
git clone git@github.com:turtlemonvh/prometheus_python_roller.git prometheus-roller
cd prometheus-roller
python setup.py develop
```
## Running tests
```bash
# Plain old python
python -m unittest discover
# If you have nose and coverage installed
nosetests --with-cover
```
## TODO
* Add IQR reducer
Metadata
Release files for prometheus_roller 0.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| prometheus_roller-0.0.2.tar.gz | 5.6 kB | Without provenance | Details for prometheus_roller-0.0.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| prometheus_roller-0.0.2-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details for prometheus_roller-0.0.2-py2.py3-none-any.whl |
Total release size: 14.5 kB
Release files / prometheus_roller-0.0.2.tar.gz
| Download URL | prometheus_roller-0.0.2.tar.gz |
|---|---|
| Size | 5.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2aed11873c7b2bef7882fd6f6bc86c09aa8ddeff59c82ec102e07fe475e416d6
|
|
BLAKE2b-256 checksum How to use checksums |
37f637dcf601f38d3a8fa51374359facc63a599629e88226a57d85f54147d21c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / prometheus_roller-0.0.2-py2.py3-none-any.whl
| Download URL | prometheus_roller-0.0.2-py2.py3-none-any.whl |
|---|---|
| Size | 8.8 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
92329c4b91052c0c3b7f298202ee06fef8f425e07424f4c4388ea7b3222b1ef1
|
|
BLAKE2b-256 checksum How to use checksums |
302647e130ba9bce65fe717076b61d43117958b0fe356cbfb7ec554133c930f9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for prometheus_roller 0.0.2
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.