A zero-contention, thread-safe metrics aggregator for high-performance Python applications.
Project description
Pylight Metrics
Zero-Contention, High-Performance Observability for Python.
pylight-metrics is a thread-safe metrics aggregator designed for high-throughput applications. It uses Thread Local Storage (TLS) to buffer metrics, ensuring your application's critical path remains lock-free.
Features
- 🚀 Zero-Contention: Writes to thread-local buffers; global locks are only acquired during infrequent merges.
- 📊 Rich Statistics: Calculates P50, P90, P99, Standard Deviation, and Counts.
- 📈 Exporters: Supports JSON, Prometheus, and CSV (Excel) formats.
- 🔌 Drop-in Ready: Use decorators like
@fast_timerand@count_calls.
⚡ Benchmarks
Comparison with prometheus-client (Official Library) on 50 concurrent threads.
| Metric Type | Library | Operations | Time | Speed (ops/sec) |
|---|---|---|---|---|
| Timer (P99 Calc) | prometheus_client |
1,000,000 | 1.70s | 585k |
| Timer (P99 Calc) | pylight-metrics | 1,000,000 | 1.27s | 782k |
Result: pylight-metrics is ~1.33x Faster on the write path because it offloads heavy math (percentiles) to the background flush step.
Installation
pip install pylight-metrics
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pylight_metrics-0.2.0.tar.gz.
File metadata
- Download URL: pylight_metrics-0.2.0.tar.gz
- Upload date:
- Size: 6.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
343235a3bc1159e3db54c6c563fecd69f4d81d17e6d45f3ce0f64c5efc0c41eb
|
|
| MD5 |
b2c923c4863a68fc6b0319a47cae713f
|
|
| BLAKE2b-256 |
e6cc53c9fa9f923b5ebf28b2b66b9f9a37b654bea2db30c73b3c76eb33cf8d09
|
File details
Details for the file pylight_metrics-0.2.0-py3-none-any.whl.
File metadata
- Download URL: pylight_metrics-0.2.0-py3-none-any.whl
- Upload date:
- Size: 4.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f5839251b70f71a1ab56fce5c3ef3e317ae2d8e2f67807789099e902b087117a
|
|
| MD5 |
978d9b5f85e9d84a8fcb1d749e1b88ab
|
|
| BLAKE2b-256 |
055567139edec22705f730718d2c640086221750d9203da7902dd516beafcad9
|