Skip to main content

Faust Prometheus Exporter

Module for exporting monitoring values for Prometheus

PyPI PyPI - Python Version GitLab last commit Docs

Test coverage Downloads GitLab stars

Faust Prometheus Helper (GPT)

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

import faust
from faust_prometheus import FaustPrometheusExporter

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

# Adding the Prometheus Exporter
exporter = FaustPrometheusExporter(app)
# see default metrics
curl localhost:8000/metrics

Playground

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:

make install-dev

After changes:

make format test

Release files for faust-prometheus-exporter 0.1.9

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

Source distribution (sdist)

Source distribution for faust-prometheus-exporter 0.1.9
File Size Uploaded
faust_prometheus_exporter-0.1.9.tar.gz 5.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for faust-prometheus-exporter 0.1.9
File Interpreter ABI Platform
faust_prometheus_exporter-0.1.9-py3-none-any.whl Python 3 none any Details

Total release size: 11.9 kB

Release files / faust_prometheus_exporter-0.1.9.tar.gz

Download URL faust_prometheus_exporter-0.1.9.tar.gz
Size 5.8 kB
Tags Source
SHA-256 checksum
How to use checksums
d390afebac2763d6a317841dfeea02200ee73ef2ab212c19f9c9b6985ee197ac
BLAKE2b-256 checksum
How to use checksums
dfed02cee9c6a13d8a139b30cba0575a25b074492ce2c3f268f59c266274b724
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-91-generic

Release files / faust_prometheus_exporter-0.1.9-py3-none-any.whl

Download URL faust_prometheus_exporter-0.1.9-py3-none-any.whl
Size 6.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1053a1242011250c0bb499c471d3f0feac08c8e5422803d0cad31f11ab222262
BLAKE2b-256 checksum
How to use checksums
b6ef815900c4ef71e786f043eddc782fdef6783522aee3d4457c5b30e7935f4b
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-91-generic
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