A library to easily measure what's going on in your python.
Project description
A library to easily measure what’s going on in your python.
Metrology allows you to add instruments to your python code and hook them to external reporting tools like Graphite so as to better understand what’s going on in your running python program.
Installing
To install :
pip install metrology
API
Gauge
A gauge is an instantaneous measurement of a value
class JobGauge(metrology.instruments.Gauge):
def value(self):
return len(queue)
gauge = Metrology.gauge('pending-jobs', JobGauge())
Counters
A counter is like a gauge, but you can increment or decrement its value
counter = Metrology.counter('pending-jobs')
counter.increment()
counter.decrement()
counter.count
Meters
A meter measures the rate of events over time (e.g., “requests per second”). In addition to the mean rate, you can also track 1, 5 and 15 minutes moving averages
meter = Metrology.meter('requests')
meter.mark()
meter.count
Timers
A timer measures both the rate that a particular piece of code is called and the distribution of its duration
timer = Metrology.timer('responses')
with timer:
do_something()
Utilization Timer
A specialized timer that calculates the percentage of wall-clock time that was spent
utimer = Metrology.utilization_timer('responses')
with utimer:
do_something()
Profilers
A profiler measures the distribution of the duration passed in a every part of the code
profiler = Metrology.profiler('slow-code')
with profiler:
run_slow_code()
Reporters
Logger Reporter
A logging reporter that write metrics to a logger
reporter = LoggerReporter(level=logging.INFO, interval=10)
reporter.start()
Graphite Reporter
A graphite reporter that send metrics to graphite
reporter = GraphiteReporter('graphite.local', 2003)
reporter.start()
Librato Reporter
A librator metric reporter that send metrics to librato API
reporter = LibratoReporter("<email>", "<token>")
reporter.start()
Ganglia Reporter
A ganglia reporter that sends metrics to gmond.
reporter = GangliaReporter("Group Name", "localhost", 8649, "udp", interval=60)
reporter.start()
Acknowledgement
This is heavily inspired by the awesome metrics library.
Project details
Release history Release notifications | RSS feed
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
File details
Details for the file metrology-0.9.0.tar.gz
.
File metadata
- Download URL: metrology-0.9.0.tar.gz
- Upload date:
- Size: 19.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cce2695841ed6a07fb3ba1b9b8d5a2f2a66e496affaf2309fffa8923fc706be6 |
|
MD5 | b06896b2286726e5cd9c5fdaa4427828 |
|
BLAKE2b-256 | 8ea037f3378267c1c8ffbb3c21eff481694587fde4ccb53f4ee74df087d64f08 |
File details
Details for the file metrology-0.9.0-py2.py3-none-any.whl
.
File metadata
- Download URL: metrology-0.9.0-py2.py3-none-any.whl
- Upload date:
- Size: 22.9 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6c595f43255f28af65e54efed83c35faf199bd153ac310734fd104f94eb62036 |
|
MD5 | 7277615622d9ea2f7062787addce7769 |
|
BLAKE2b-256 | 410de8d317fd8a97ebb8ecfaa35937aff4fba47dc79c98554522f5cd28cd4c42 |