Send runtime measurements of your code to InfluxDB
Project description
Timekeeper is a library for instrumentation of live Python code by sending measurements to InfluxDB.
Requires Python 2.7 or 3.2+, and InfluxDB 0.9.0+.
Usage
=====
You can use a context manager or decorate a function to record the wall clock time of how long it took that function or block of code to complete:
```python
from timekeeper import TimeKeeper
tk = TimeKeeper(
"udp+influxdb://localhost/databasename",
prefix="location-1.cluster-1.app-1.", # if you prefer Graphite style over tags
tags={"host": "location-1.cluster-1.app-1"},
)
@tk.decorate("some_slow_function", tags={"foo": "bar"})
def slowpoke():
sleep(9001)
def slowpoke2():
with tk.context("some_other_slow_function", tags={"foo": "baz"}):
sleep(9001)
```
Installation
============
```
pip install timekeeper
```
---
![PyPI downloads](http://img.shields.io/pypi/dm/timekeeper.svg) ![PyPI version](http://img.shields.io/pypi/v/timekeeper.svg) ![Python 2.7](http://img.shields.io/badge/Python-2.7-green.svg) ![Python 3.2+](http://img.shields.io/badge/Python-3.2+-green.svg) ![License](http://img.shields.io/badge/License-ISC-red.svg)
Requires Python 2.7 or 3.2+, and InfluxDB 0.9.0+.
Usage
=====
You can use a context manager or decorate a function to record the wall clock time of how long it took that function or block of code to complete:
```python
from timekeeper import TimeKeeper
tk = TimeKeeper(
"udp+influxdb://localhost/databasename",
prefix="location-1.cluster-1.app-1.", # if you prefer Graphite style over tags
tags={"host": "location-1.cluster-1.app-1"},
)
@tk.decorate("some_slow_function", tags={"foo": "bar"})
def slowpoke():
sleep(9001)
def slowpoke2():
with tk.context("some_other_slow_function", tags={"foo": "baz"}):
sleep(9001)
```
Installation
============
```
pip install timekeeper
```
---
![PyPI downloads](http://img.shields.io/pypi/dm/timekeeper.svg) ![PyPI version](http://img.shields.io/pypi/v/timekeeper.svg) ![Python 2.7](http://img.shields.io/badge/Python-2.7-green.svg) ![Python 3.2+](http://img.shields.io/badge/Python-3.2+-green.svg) ![License](http://img.shields.io/badge/License-ISC-red.svg)
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
timekeeper-0.1.1.tar.gz
(2.9 kB
view details)
Built Distribution
File details
Details for the file timekeeper-0.1.1.tar.gz
.
File metadata
- Download URL: timekeeper-0.1.1.tar.gz
- Upload date:
- Size: 2.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 49714ed8793aa2e0898e12dddd53b7f7de9f930260de725255555af7edb2d8e3 |
|
MD5 | 8d2389b0a7b5ce449648fb43a222ae54 |
|
BLAKE2b-256 | 4355fd67e94781e350209ba525e965ffed7c453845e5cd90b01de7a00a98ab0a |
File details
Details for the file timekeeper-0.1.1-py2.py3-none-any.whl
.
File metadata
- Download URL: timekeeper-0.1.1-py2.py3-none-any.whl
- Upload date:
- Size: 3.0 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 946340b0fa5ab8db38f44de977d5fd85639c7a32973e4cd3152cf0b8c8768adf |
|
MD5 | c3d835fec8108cbb5dbb5d8636d44f0d |
|
BLAKE2b-256 | 4f63d3eeceb42c151b2d78771fc3446d208886643d30461918d183650fac7355 |