Skip to main content

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.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

metrology-0.9.1.tar.gz (19.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

metrology-0.9.1-py2.py3-none-any.whl (22.9 kB view details)

Uploaded Python 2Python 3

File details

Details for the file metrology-0.9.1.tar.gz.

File metadata

  • Download URL: metrology-0.9.1.tar.gz
  • Upload date:
  • Size: 19.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for metrology-0.9.1.tar.gz
Algorithm Hash digest
SHA256 0582a869953c81b362b689169e77c388526a33f8e9d85c81feefeb1a10ef9dfd
MD5 e60b926e140cddf2868abd6bf0bea3a4
BLAKE2b-256 1823b614d5a76ea7c0b3216f8322503a25e0c7d3b814503a55a37d97604128b3

See more details on using hashes here.

File details

Details for the file metrology-0.9.1-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for metrology-0.9.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 6102a4bdc3fa19ee091b4ccd28db9698d86e3f3ba3822127c81bc7dddf60b1df
MD5 dae374853cba0196cf039229a0140981
BLAKE2b-256 bea6f7ad04e6c14c2aeab967c7ea5da6685871d5641c44ef08262f8435cf8258

See more details on using hashes here.

Release history Release notifications | RSS feed

1.3.0

2 files

1.2.4

2 files

1.2.3

2 files

1.2.2

2 files

1.2.1

2 files

1.2.0

2 files

1.1.0

2 files

1.0.1

2 files

1.0.0

2 files

0.10.1

2 files

0.10.0

2 files

This release

0.9.1 This release

2 files

0.9.0

2 files

0.8.0

1 file

0.7.3

1 file

0.7.2

1 file

0.7.1

1 file

0.7.0

1 file

0.6.3

1 file

0.6.2

1 file

0.6.1

1 file

0.6

1 file

0.5

1 file

0.4.1

1 file

0.4

1 file

0.3.3

1 file

0.3.2

1 file

0.3.1

1 file

0.2

1 file

0.1

1 file

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