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.
Source Distribution
log-metrics-0.0.2.tar.gz
(3.6 kB
view details)
File details
Details for the file log-metrics-0.0.2.tar.gz
.
File metadata
- Download URL: log-metrics-0.0.2.tar.gz
- Upload date:
- Size: 3.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | df43f71cccdff643df6d7fe61cc269170e4233c62bcfee0bd03909d053bd12c1 |
|
MD5 | edb57b6f3e2c90845622ec7a2f91634d |
|
BLAKE2b-256 | c5c897c6fcd9c20b5ede8b92958446af98179461be109fecf3fd0caed05896be |