Skip to main content

A Prometheus exporter for Python concurrent.futures executors

Project description

executor-exporter

codecov CI

A Prometheus metrics exporter for Python concurrent.futures executors. Provides instrumented drop-in replacements for ThreadedPoolExecutor and ProcessPoolExecutor.

water level ruler photo

Public domain photo by Patsy Lynch. More info

Install it from PyPI

pip install executor-exporter

Usage

from executor_exporter import ThreadPoolExecutor
# or
from executor_exporter import ProcessPoolExecutor

If you stick to the public APIs of concurrent.future executors (consisting of __init__, submit, map and shutdown methods), you just need to replace the builtin executor with its instrumented version provided by this package.

The provided executors act as proxies for the builtin executor while collecting the following metrics:

The __init__ methods of the instrumented executors take an additional exporter_id : Optional[str] parameter, used as the value for exporter metric label. If your use multiple executor instances of the same type you can measure them separately by defining a unique id for each instance. Conversely, by using the same id across multiple instances their metrics will be combined and exported as if they came from a single instance.

Custom executors

The instrumented executors are just wrappers around the builtin executors provided for convenience, while InstrumentedExecutorProxy does the heavy-lifting. If you're using a custom executor, you can wrap it like this:

from executor_exporter import InstrumentedExecutorProxy, ExecutorExporter

max_workers = 42
executor = YourCustomExecutor(max_workers)
exporter = ExecutorExporter(executor)

instrumented_executor = InstrumentedExecutorProxy(executor, exporter, max_workers)

TODO

  • Testing
  • Housekeeping
    • Makefile
    • metrics table gen
  • CI/CD
  • codecov

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

executor-exporter-0.1.2.tar.gz (8.5 kB view details)

Uploaded Source

Built Distribution

executor_exporter-0.1.2-py3-none-any.whl (9.5 kB view details)

Uploaded Python 3

File details

Details for the file executor-exporter-0.1.2.tar.gz.

File metadata

  • Download URL: executor-exporter-0.1.2.tar.gz
  • Upload date:
  • Size: 8.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.4 CPython/3.8.5 Linux/5.4.0-80-generic

File hashes

Hashes for executor-exporter-0.1.2.tar.gz
Algorithm Hash digest
SHA256 e5fd5da42b4453b508b2a5539e0f88b40f4afc56990f14664a2ea9e8cad1fd4c
MD5 a4a40fc4a027f5fc4b97ecb4fdc71843
BLAKE2b-256 e72f1b24231bf5ff1081ef298dba688e8ab493586537a57554af0d8c421d8494

See more details on using hashes here.

File details

Details for the file executor_exporter-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: executor_exporter-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 9.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.4 CPython/3.8.5 Linux/5.4.0-80-generic

File hashes

Hashes for executor_exporter-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 7e8a1915db68e5a6deba46d4125e77f8bf0844a611ddd88d2ad21084b9063540
MD5 6550b13d11ac3fbe9605a2094e664671
BLAKE2b-256 8c35a26a7edffce6d9c1de9bbaf10978cd0f256ba54eee2d0d007d573dbef5d5

See more details on using hashes here.

Supported by

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