Metadata-Version: 2.1
Name: aioworkers-prometheus
Version: 0.5.1
Summary: aioworkers prometheus integration
Home-page: https://github.com/aioworkers/aioworkers-prometheus
Author: Alexander Malev
Author-email: aamalev@gmail.com
License: Apache Software License 2.0
Keywords: aioworkers prometheus
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Framework :: AsyncIO
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Requires-Python: >=3.7
License-File: LICENSE

aioworkers-prometheus
=====================

.. image:: https://github.com/aioworkers/aioworkers-prometheus/workflows/Tests/badge.svg
  :target: https://github.com/aioworkers/aioworkers-prometheus/actions?query=workflow%3ATests

.. image:: https://codecov.io/gh/aioworkers/aioworkers-prometheus/branch/master/graph/badge.svg
  :target: https://codecov.io/gh/aioworkers/aioworkers-prometheus

.. image:: https://img.shields.io/pypi/v/aioworkers-prometheus.svg
  :target: https://pypi.org/project/aioworkers-prometheus
  :alt: PyPI version

.. image:: https://img.shields.io/pypi/pyversions/aioworkers-prometheus.svg
  :target: https://pypi.org/project/aioworkers-prometheus
  :alt: Python versions


Use
---

.. code-block:: yaml

    metric:
      registry: aioworkers
      namespace: aioworkers_test_metric
      metrics:
        my_counter:
          type: counter
          name: test_counter
          documentation: Counter for tests
        my_histogram:
          type: histogram
          name: test_histogram
          documentation: Histogram for tests
          buckets: [30, 90, 100, 200, 400, 800]


Use in code

.. code-block:: python

    context.metric.my_counter.inc()
    context.metric.my_histogram.observe(542)

    with context.metric.my_histogram.time():
        await asyncio.sleep(1)


Add global labels to default registry to exposition

.. code-block:: yaml

    prometheus:
      registry: aioworkers
      labels:
        env: prod


Serve port 8000 for prometheus

.. code-block:: yaml

    prometheus:
      port: 8000
      registry: aioworkers


Push to graphite localhost:9090

.. code-block:: yaml

    prometheus:
      registry: aioworkers
      graphite:
        address: localhost:9090
        interval: 1m
        prefix: aioworkers.test


Development
-----------

Install dev requirements:


.. code-block:: shell

    pipenv install --dev --skip-lock


Run tests:

.. code-block:: shell

    pipenv run pytest
