Skip to main content

WoodMac's Faust Prometheus Library

Project description

Faust Prometheus

This library uses sensors of Faust. Those sensors are events based. Our monitor implements that interface and hooks some actions when those events happen. That allows us to create our own prometheus Counters, Gauges and Histograms. I created some predefined metrics, but we can expand on them in the future.

Installation

To use this library in your faust project just add faustprometheus or install it through pip:

pip install faustprometheus

Usage

Add PrometheusMonitor to the app as seen below:

    import faust
    from faustprometheus.monitor import PrometheusMonitor

    app = faust.App('example', broker='kafka://')
    app.monitor = PrometheusMonitor(app)

You can also configure some global options to monitor through PrometheusMonitorConfig, such as 2 levels of prefixes, through namespace and subsystem. The path exposing prometheus metrics can be set through metrics config, with /metrics as default value. I added labels to config, but are not applied to monitor due to lack of my understanding of faust sensors and prometheus.

    from faustprometheus.config import PrometheusMonitorConfig

    monitor_config = PrometheusMonitorConfig(
        path='/metrics',
        namespace='faust',
        subsystem='foo-app',
        labels=['v2.3', 'prod']
        )        

Tests

Library is fully unit tested and can be run by

    pytest

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

faustprometheus-0.0.5.tar.gz (9.3 kB view details)

Uploaded Source

File details

Details for the file faustprometheus-0.0.5.tar.gz.

File metadata

  • Download URL: faustprometheus-0.0.5.tar.gz
  • Upload date:
  • Size: 9.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.6

File hashes

Hashes for faustprometheus-0.0.5.tar.gz
Algorithm Hash digest
SHA256 ae5dcbe2f4569b5f189476743bbd724a92d99a510355e1a9d1d8cbf0ee9982fc
MD5 f030129023e427d057948f68ea9ec82e
BLAKE2b-256 0b23f9684df71c4b572abf26a8484e409183e0f7b7e97054a280adb115a59b9f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page