Registry / observability / pyformance

pyformance

JSON →
library0.4pypypiunverified

Pyformance is a Python library for performance metrics, inspired by Coda Hale's Yammer metrics (now Dropwizard Metrics). It provides various metric types like Counters, Timers, Gauges, and Histograms, along with different reporters (e.g., Console, Graphite). The current version is 0.4, released in 2016. The project is no longer actively maintained.

pip install pyformance
INSTALL
IMPORT
SIG · PYFORMANCE
P
pyformance
observabilitypythonv0.4
Install
2.5s avg
Import
—
Disk
17MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.9–3.13
musl
3.9–3.13
Install & Compatibility
Where this runs
tested against v0.4 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.10–3.910 runs
installs and imports cleanly · install 0.0s · import 0.000s · 19.8MB
glibc
py 3.10–3.910 runs
installs and imports cleanly · install 2.5s · import 0.000s · 20MB
17MB installed
● package 17MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

MetricRegistry
✓ from pyformance import MetricRegistry
✗ from pyformance import MetricRegistry

This quickstart demonstrates how to initialize a MetricRegistry, create and interact with common metric types (Counter, Timer, Gauge), and report their values using the ConsoleReporter.

import time from pyformance import registry, meters, reporters # 1. Initialize a MetricRegistry metrics = registry.MetricRegistry() # 2. Create and use a Counter request_counter = metrics.get_or_create_metric('app.requests.total', meters.Counter) request_counter.inc() # Increment by 1 request_counter.inc(5) # Increment by 5 # 3. Create and use a Timer processing_timer = metrics.get_or_create_metric('app.processing_time', meters.Timer) with processing_timer.time(): time.sleep(0.05) # Simulate some work # 4. Create and use a Gauge (custom implementation for dynamic values) class QueueSizeGauge(meters.Gauge): def __init__(self, queue_list): super().__init__() self._queue_list = queue_list def get_value(self): return len(self._queue_list) my_queue_data = [1, 2, 3, 4, 5] metrics.add_metric('app.queue.size', QueueSizeGauge(my_queue_data)) # 5. Report metrics (e.g., to console) console_reporter = reporters.ConsoleReporter() console_reporter.add_metric_registry(metrics) print("\n--- Pyformance Metrics Report ---") console_reporter.report() print("---------------------------------")
Debug
Known issues
breakingPyformance is not actively maintained since 2016. It may not be compatible with newer Python versions (3.8+) and will not receive security updates or bug fixes. Consider more modern alternatives for new projects.
fix
For new projects, evaluate actively maintained libraries like `prometheus_client` or `opentelemetry` for robust metrics and monitoring solutions.
affects: 0.4 and earlier
gotchaThe library explicitly requires Python >=2.7 and !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*. While it supports Python 3.4+, compatibility with very recent Python versions (3.8+) is not guaranteed due to lack of testing and maintenance.
fix
If encountering issues on newer Python versions, try running in a Python 3.4-3.7 environment or migrate to a different metrics library. Check your `python_requires` setting if packaging.
affects: 0.4
gotchaWhen creating a Gauge, you must subclass `pyformance.meters.Gauge` and implement the `get_value` method to return the current metric value. Unlike Counters or Timers, Gauges are not updated directly but rather poll their value.
fix
Define a custom class inheriting from `meters.Gauge` and override `get_value()`. Then, use `metrics.add_metric('metric.name', MyCustomGauge())` to register it.
affects: 0.4
Upgrade
Version history
0.4latest on PyPI · released Oct 8, 2017
Audit
Dependencies

No dependency data recorded yet.

Agent activity
22 hits · last 30 days
node
20
OpenAI (training)
2
Resources
pyformance — pip install pyformance · libregistry