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 details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: executor-exporter-0.1.1.tar.gz
  • Upload date:
  • Size: 4.1 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.1.tar.gz
Algorithm Hash digest
SHA256 f1a26346c9297103b1362a88363ca7a112d94b251fda5dece7c1d029ede3ed5c
MD5 bd17541c3efb8c95c41d7c402b3ebb8f
BLAKE2b-256 33b2547edb2ec7cbd92c033329ea53da6c4438b43024d3874d40ed2178bd4a62

See more details on using hashes here.

File details

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

File metadata

  • Download URL: executor_exporter-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 5.0 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1cd6c1abede4dcbd4b1fe1247ebb18def32348063eefdbfb23386637a2cca3e5
MD5 c4e8c196b31a019d14829e849f2b2217
BLAKE2b-256 1f89981a8d33c40af1363944f9642be418a830af8615e4340d8cd7bdbba902ad

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