Skip to main content

Python Metric Logger.

Project description

log-metrics

log-metrics is a tiny metrics logger, based on the l2met format.

Installation

$ pip install log-metrics

Usage

Everything takes place from the log_metrics module, which can be imported like so

>>> import log_metrics

Samples

>>> log_metrics.sample('process.foo.memory.mb', '52.54')
sample#process.foo.memory.mb=52.54

Measurements

>>> log_metrics.measure('myfoo.ms', '150')
measure#myfoo.ms=150

Uniques

>>> log_metrics.unique('user.clicked', 'bob')
unique#user.clicked=bob
>>> log_metrics.unique('user.clicked', 'joey')
unique#user.clicked=joey
>>> log_metrics.unique('user.clicked', 'jenny')
unique#user.clicked=jenny

Counters

>>> log_metrics.increment('myfoo')
count#myfoo=1
>>> log_metrics.increment('myfoo', 3)
count#myfoo=3

Timers

>>> with log_metrics.timer('my-timed-context'):
...     time.sleep(1)
measure#my-timed-context.ms=1001.20
>>> @log_metrics.timer('my-timed-decorator'):
... def my_func():
...     time.sleep(0.5)
>>> my_func()
measure#my-timed-decorator.ms=504.20

History

0.0.2 (2014-04-14)

  • Added more documentation for simple usage.
  • Worked on installation utilities.
  • Still no tests :(.

0.0.1 (2014-04-14)

  • Initial release.

Project details


Download files

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

Files for log-metrics, version 0.0.2
Filename, size File type Python version Upload date Hashes
Filename, size log-metrics-0.0.2.tar.gz (3.6 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page