faust-prometheus-exporter


Namefaust-prometheus-exporter JSON
Version 0.1.9 PyPI version JSON
download
home_pagehttps://gitlab.com/rocshers/python/faust-prometheus
SummaryModule for exporting monitoring values for Prometheus
upload_time2024-02-12 13:51:58
maintainer
docs_urlNone
authorirocshers
requires_python>=3.8,<4
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Faust Prometheus Exporter

Module for exporting monitoring values for Prometheus

[![PyPI](https://img.shields.io/pypi/v/faust-prometheus-exporter)](https://pypi.org/project/faust-prometheus-exporter/)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/faust-prometheus-exporter)](https://pypi.org/project/faust-prometheus-exporter/)
[![GitLab last commit](https://img.shields.io/gitlab/last-commit/rocshers/python/faust-prometheus)](https://gitlab.com/rocshers/python/faust-prometheus)
[![Docs](https://img.shields.io/badge/docs-exist-blue)](https://rocshers.gitlab.io/python/faust-prometheus/)

[![Test coverage](https://codecov.io/gitlab/rocshers:python/faust-prometheus/graph/badge.svg?token=3C6SLDPHUC)](https://codecov.io/gitlab/rocshers:python/faust-prometheus)
[![Downloads](https://static.pepy.tech/badge/faust-prometheus-exporter)](https://pepy.tech/project/faust-prometheus-exporter)
[![GitLab stars](https://img.shields.io/gitlab/stars/rocshers/python/faust-prometheus)](https://gitlab.com/rocshers/python/faust-prometheus)

[`Faust Prometheus Helper (GPT)`](https://chat.openai.com/g/g-SZY389z0t-faust-prometheus-helper)

## Functionality

- Adds `/metrics` endpoint
- Gives basic `Prometheus-client` metrics
- Gives custom user`s metrics
- Adds internal `faust` metrics

## Installation

`pip install faust-prometheus-exporter`

## Quick start


```python
import faust
from faust_prometheus import FaustPrometheusExporter

app = faust.App('app', broker='localhost:9092')

# Adding the Prometheus Exporter
exporter = FaustPrometheusExporter(app)
```

```bash
# see default metrics
curl localhost:8000/metrics
```

## Playground

```python
import logging
from random import randint

import faust
from prometheus_client import Counter, Histogram

from faust_prometheus import FaustPrometheusExporter

logger = logging.getLogger('app')

# Prometheus custom metrics
prometheus_counter_topic_1_messages = Counter('topic_1_messages', 'Count of messages successfully processed from topic_1')
prometheus_histogram_size_messages = Histogram('size_messages', 'Histogram about messages size')

app = faust.App(
    'faust_prometheus',
    broker='localhost:9092',
)

# Adding the Prometheus Exporter
exporter = FaustPrometheusExporter(app)

topic_1 = app.topic('topic_1')

@app.agent(topic_1)
async def agent_topic_1(messages: faust.Stream[str]):
    async for message in messages:
        logger.info(f'Received topic_1 message: {message}')
        prometheus_counter_topic_1_messages.inc()
        prometheus_histogram_size_messages.observe(len(message))

@app.timer(interval=1.0)
async def example_sender(app):
    await topic_1.send(value='Nisi lorem ullamco veniam elit' * randint(1, 10))

if __name__ == '__main__':
    app.main()

```

## Contribute

Issue Tracker: <https://gitlab.com/rocshers/python/faust-prometheus/-/issues>  
Source Code: <https://gitlab.com/rocshers/python/faust-prometheus>

Before adding changes:

```bash
make install-dev
```

After changes:

```bash
make format test
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://gitlab.com/rocshers/python/faust-prometheus",
    "name": "faust-prometheus-exporter",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8,<4",
    "maintainer_email": "",
    "keywords": "",
    "author": "irocshers",
    "author_email": "develop.iam@rocshers.com",
    "download_url": "https://files.pythonhosted.org/packages/df/ed/02cee9c6a13d8a139b30cba0575a25b074492ce2c3f268f59c266274b724/faust_prometheus_exporter-0.1.9.tar.gz",
    "platform": null,
    "description": "# Faust Prometheus Exporter\n\nModule for exporting monitoring values for Prometheus\n\n[![PyPI](https://img.shields.io/pypi/v/faust-prometheus-exporter)](https://pypi.org/project/faust-prometheus-exporter/)\n[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/faust-prometheus-exporter)](https://pypi.org/project/faust-prometheus-exporter/)\n[![GitLab last commit](https://img.shields.io/gitlab/last-commit/rocshers/python/faust-prometheus)](https://gitlab.com/rocshers/python/faust-prometheus)\n[![Docs](https://img.shields.io/badge/docs-exist-blue)](https://rocshers.gitlab.io/python/faust-prometheus/)\n\n[![Test coverage](https://codecov.io/gitlab/rocshers:python/faust-prometheus/graph/badge.svg?token=3C6SLDPHUC)](https://codecov.io/gitlab/rocshers:python/faust-prometheus)\n[![Downloads](https://static.pepy.tech/badge/faust-prometheus-exporter)](https://pepy.tech/project/faust-prometheus-exporter)\n[![GitLab stars](https://img.shields.io/gitlab/stars/rocshers/python/faust-prometheus)](https://gitlab.com/rocshers/python/faust-prometheus)\n\n[`Faust Prometheus Helper (GPT)`](https://chat.openai.com/g/g-SZY389z0t-faust-prometheus-helper)\n\n## Functionality\n\n- Adds `/metrics` endpoint\n- Gives basic `Prometheus-client` metrics\n- Gives custom user`s metrics\n- Adds internal `faust` metrics\n\n## Installation\n\n`pip install faust-prometheus-exporter`\n\n## Quick start\n\n\n```python\nimport faust\nfrom faust_prometheus import FaustPrometheusExporter\n\napp = faust.App('app', broker='localhost:9092')\n\n# Adding the Prometheus Exporter\nexporter = FaustPrometheusExporter(app)\n```\n\n```bash\n# see default metrics\ncurl localhost:8000/metrics\n```\n\n## Playground\n\n```python\nimport logging\nfrom random import randint\n\nimport faust\nfrom prometheus_client import Counter, Histogram\n\nfrom faust_prometheus import FaustPrometheusExporter\n\nlogger = logging.getLogger('app')\n\n# Prometheus custom metrics\nprometheus_counter_topic_1_messages = Counter('topic_1_messages', 'Count of messages successfully processed from topic_1')\nprometheus_histogram_size_messages = Histogram('size_messages', 'Histogram about messages size')\n\napp = faust.App(\n    'faust_prometheus',\n    broker='localhost:9092',\n)\n\n# Adding the Prometheus Exporter\nexporter = FaustPrometheusExporter(app)\n\ntopic_1 = app.topic('topic_1')\n\n@app.agent(topic_1)\nasync def agent_topic_1(messages: faust.Stream[str]):\n    async for message in messages:\n        logger.info(f'Received topic_1 message: {message}')\n        prometheus_counter_topic_1_messages.inc()\n        prometheus_histogram_size_messages.observe(len(message))\n\n@app.timer(interval=1.0)\nasync def example_sender(app):\n    await topic_1.send(value='Nisi lorem ullamco veniam elit' * randint(1, 10))\n\nif __name__ == '__main__':\n    app.main()\n\n```\n\n## Contribute\n\nIssue Tracker: <https://gitlab.com/rocshers/python/faust-prometheus/-/issues>  \nSource Code: <https://gitlab.com/rocshers/python/faust-prometheus>\n\nBefore adding changes:\n\n```bash\nmake install-dev\n```\n\nAfter changes:\n\n```bash\nmake format test\n```\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Module for exporting monitoring values for Prometheus",
    "version": "0.1.9",
    "project_urls": {
        "Homepage": "https://gitlab.com/rocshers/python/faust-prometheus",
        "Repository": "https://gitlab.com/rocshers/python/faust-prometheus"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b6ef815900c4ef71e786f043eddc782fdef6783522aee3d4457c5b30e7935f4b",
                "md5": "93c151e42947762660f55b5b93fc2715",
                "sha256": "1053a1242011250c0bb499c471d3f0feac08c8e5422803d0cad31f11ab222262"
            },
            "downloads": -1,
            "filename": "faust_prometheus_exporter-0.1.9-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "93c151e42947762660f55b5b93fc2715",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8,<4",
            "size": 6181,
            "upload_time": "2024-02-12T13:51:57",
            "upload_time_iso_8601": "2024-02-12T13:51:57.458790Z",
            "url": "https://files.pythonhosted.org/packages/b6/ef/815900c4ef71e786f043eddc782fdef6783522aee3d4457c5b30e7935f4b/faust_prometheus_exporter-0.1.9-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "dfed02cee9c6a13d8a139b30cba0575a25b074492ce2c3f268f59c266274b724",
                "md5": "4937cd0689c954ef2302f4a962b6d40d",
                "sha256": "d390afebac2763d6a317841dfeea02200ee73ef2ab212c19f9c9b6985ee197ac"
            },
            "downloads": -1,
            "filename": "faust_prometheus_exporter-0.1.9.tar.gz",
            "has_sig": false,
            "md5_digest": "4937cd0689c954ef2302f4a962b6d40d",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8,<4",
            "size": 5754,
            "upload_time": "2024-02-12T13:51:58",
            "upload_time_iso_8601": "2024-02-12T13:51:58.753019Z",
            "url": "https://files.pythonhosted.org/packages/df/ed/02cee9c6a13d8a139b30cba0575a25b074492ce2c3f268f59c266274b724/faust_prometheus_exporter-0.1.9.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-02-12 13:51:58",
    "github": false,
    "gitlab": true,
    "bitbucket": false,
    "codeberg": false,
    "gitlab_user": "rocshers",
    "gitlab_project": "python",
    "lcname": "faust-prometheus-exporter"
}
        
Elapsed time: 0.17288s