timekeeper

Send runtime measurements of your code to InfluxDB


Keywords
profiling, profile, metrics, instrumentation, measure, influxdb
License
ISC
Install
pip install timekeeper==0.1.1

Documentation

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:

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   PyPI version   Python 2.7   Python 3.2+   License