Registry / observability / hdrhistogram

hdrhistogram

JSON →
library0.10.7pypypi✓ verified 87d ago

HdrHistogram is a native Python wrapper for the High Dynamic Range Histogram C library, designed for recording and analyzing sampled data (like latencies) with high precision over a wide dynamic range. It's currently at version 0.10.3 and typically sees maintenance releases as needed, with major changes often aligning with the upstream C library or Python version support.

pip install hdrhistogram
INSTALL
IMPORT
SIG · HDRHISTOGRAM
H
hdrhistogram
observabilitypythonv0.10.7
Install
2.0s avg
Import
—
Disk
20MB
Pass rate
8/ 10
Env Coverage8 / 10
glibc
3.9–3.13
musl
3.9–3.13
Install & Compatibility
Where this runs
tested against v0.10.7 · 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
glibc
py 3.10
✓ —
✓ 1.75s
py 3.11
✓ —
✓ 1.85s
py 3.12
✓ —
✓ 2.3s
py 3.13
1/2 runs
1/2 runs
py 3.9
✓ —
✓ 2.05s
20MB installed
● package 20MB
Code
Verified usage

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

HdrHistogram
✓ from hdrh.histogram import HdrHistogram
✗ from hdrhistogram import HdrHistogram

Initialize an HdrHistogram, record sample values, and retrieve various statistics including min, max, mean, standard deviation, and specific percentiles. The example also shows how the histogram automatically adjusts to values exceeding its initial maximum.

from hdrhistogram import HdrHistogram # Create a histogram with a precision of 3 significant digits, # a max value of 1,000,000 (1 second), and a min value of 1 (1 microsecond). # The internal C library will auto-adjust max value if exceeded. h = HdrHistogram(1, 1_000_000, 3) # Record some values (e.g., latencies in microseconds) h.record_value(100) h.record_value(150) h.record_value(1000) h.record_value(1000) h.record_value(1000) h.record_value(5000) h.record_value(100_000) # This will exceed the initial max, but the histogram self-adjusts print(f"Total count: {h.total_count}") print(f"Min value: {h.min_value}") print(f"Max value: {h.max_value}") print(f"Mean value: {h.mean_value:.2f}") print(f"Std Deviation: {h.std_deviation:.2f}") print("\nPercentiles:") print(f"50th percentile: {h.get_value_at_percentile(50):.2f}") print(f"90th percentile: {h.get_value_at_percentile(90):.2f}") print(f"99th percentile: {h.get_value_at_percentile(99):.2f}") print(f"99.9th percentile: {h.get_value_at_percentile(99.9):.2f}") # You can also iterate through percentiles print("\nPercentile distribution:") for p, v in h.get_percentile_to_value_list(): if p % 10 == 0 or p > 99: # print every 10th percentile and high percentiles print(f"{p:>6.2f}th percentile: {v:>10.2f}") # Reset the histogram h.reset() print(f"\nAfter reset, total count: {h.total_count}")
Debug
Known issues
breakingPython 2.7 support was dropped in version 0.10.0. Projects still using Python 2.7 will fail to install or run with newer versions.
fix
Upgrade your project's Python interpreter to Python 3.x (3.6+ is generally recommended for current Python libraries).
affects: >=0.10.0
gotchaThe `dump_hdrh` command-line utility was not correctly installed with `pip` in versions 0.10.0 through 0.10.2.
fix
Upgrade to `hdrhistogram==0.10.3` or newer to ensure the `dump_hdrh` script is correctly installed and available in your PATH.
affects: 0.10.0 - 0.10.2
deprecatedOlder versions (pre-0.10.0) had a dependency on the `future` package, which contained a known denial-of-service vulnerability (CVE-2022-40899). This dependency has been removed.
fix
Upgrade to `hdrhistogram==0.10.0` or newer to remove the vulnerable `future` dependency and ensure better Python 3 compatibility.
affects: <0.10.0
Upgrade
Version history
0.10.7latest on PyPI · released Jun 9, 2026
Audit
Dependencies

No dependency data recorded yet.

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