Skip to main content

No project description provided

Project description

executor-exporter

codecov CI

A Prometheus 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 and map 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:

Additional parameters

The __init__ methods of the instrumented executors take two additional optional parameters:

Parameter Type Default value Description
exporter_id str "" This id is used as the value for the exporter label in all metrics. Useful when your app uses multiple executors and you want to measure them separately
registry prometheus_client.CollectorRegistry prometheus_client.REGISTRY (default registry) Useful when you're using a registry other than the default for whatever reason, e.g. using prometheus_client multiprocess mode

Custom executors

The InstrumentedExecutorProxy class does the heavy-lifting. If you're using a custom executor, you can still instrument them by using wrapping it:

from executor_exporter import InstrumentedExecutorProxy, ExecutorExporter

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

instrumented_executor = InstrumentedExecutorProxy(executor, exporter, max_workers)

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.1.tar.gz (4.1 kB view hashes)

Uploaded Source

Built Distribution

executor_exporter-0.1.1-py3-none-any.whl (5.0 kB view hashes)

Uploaded Python 3

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