Skip to main content

Gangplank

Exposing Keras Metrics to Prometheus

Keras is a library for creating artificial neural networks. Prometheus is a monitoring system that pulls metrics from applications and infrastructure. Gangplank is a bridge from Keras to Prometheus that exports Keras training, evaluation and inference metrics to Prometheus.

Keras metrics are exposed in two ways:

  • Training and testing metrics use Keras callbacks to push metrics to a Prometheus Pushgateway.
  • Inference metrics are exposed by instrumenting a proxy of a Keras model.

The examples demonstrate both techniques to export metrics to Prometheus.

What Metrics are exported?

Training Metrics

During training, the following metrics are exported:

  • The number of completed training epochs
  • The time spent training
  • The number of model weights (both trainable and non-trainable)
  • The model's loss
  • All metrics configured for the model (e.g. accuracy for a classification model or mean absolute error for a regression model)
  • (Optionally) A histogram of the model's trainable weights at the end of the training run

Testing (Evaluation) Metrics

For testing (i.e. evaluation), the following metrics are exported:

  • The time spent testing
  • The model's loss
  • All metrics configured for the model (accuracy, mean absolute error, etc.)
  • (Optionally) A histogram of the model's trainable weights

Prediction (Inference) Metrics

A deployed model can expose the following metrics:

  • The total number of model predictions
  • The time spent doing inference
  • (Optionally) Drift metrics; e.g. a p-value

Installing Gangplank

Gangplank can be installed from PyPI

pip install gangplank

The installation will also install Keras. Keras needs a tensor arithmetic backend like TensorFlow, JAX or PyTorch. You can install a backend at the same time as installing Gangplank by running one of the following

pip install gangplank[tensorflow]
pip install gangplank[jax]
pip install gangplank[torch]

Note: Running, e.g., pip install gangplank[jax] will install a CPU-only version of JAX. If you want, say, CUDA support you should install JAX separately

pip install gangplank
pip install jax[cuda12]

Similar comments apply to TensorFlow and PyTorch.

Examples

Examples of using Gangplank can be found here.

Acknowledgement

The example code uses a model from "Deep Learning with Python, Second Edition" by François Chollet. Gangplank was inspired by the same book's coverage of callbacks and TensorBoard.

Metadata

Release files for gangplank 0.5.0

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

Source distribution (sdist)

Source distribution for gangplank 0.5.0
File Size Uploaded Provenance Actions
gangplank-0.5.0.tar.gz 8.0 kB With provenance Details for gangplank-0.5.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for gangplank 0.5.0
File Interpreter ABI Platform Actions
gangplank-0.5.0-py3-none-any.whl Python 3 none any Details for gangplank-0.5.0-py3-none-any.whl

Total release size: 15.4 kB

Release files / gangplank-0.5.0.tar.gz

Download URL gangplank-0.5.0.tar.gz
Size 8.0 kB
Tags Source
SHA-256 checksum
How to use checksums
36f569d869ed16ab5b501dc4fbe2ab02479d72f4dcbcf68ff26508acfd08b7ae
BLAKE2b-256 checksum
How to use checksums
7abb2d706f6abaa7ed3854c1c34f625c7866a821cccfd4e7164f196517b57933
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 15, 2025.

Transparency log

Release files / gangplank-0.5.0-py3-none-any.whl

Download URL gangplank-0.5.0-py3-none-any.whl
Size 7.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d855436b48d6fdf515735dc539dc550d3df68909062932d7cd1d2cdf2364a65b
BLAKE2b-256 checksum
How to use checksums
272c3c565b7e2f0340c2b7ba0d8e5623f3627c98bd5fba8c9fac02709ad252eb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 15, 2025.

Transparency log

Security for gangplank 0.5.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for gangplank-0.5.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 15, 2025.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.5.0 This release

2 release files Full provenance

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