Striemann

https://travis-ci.org/madedotcom/striemann.svg?branch=master https://readthedocs.org/projects/striemann/badge/?version=latest

Striemann provides a developer friendly interface for sending metrics to the Riemann monitoring system. It’s heavily inspired by statsd. It aims to provide a strongly opinionated way for developers to record metrics from their applications.

Installation

Striemann is available on the cheese shop.

pip install striemann

Documentation is available on Read the Docs

Basic Usage

from striemann import RiemannTransport, Metrics

# Transports are responsible for sending metrics to an endpoint
transport = RiemannTransport("localhost", 5555)

# the Metrics class is the entrypoint for the library
metrics = Metrics(transport)

# Counters keep track of how often a thing happens.
# They send the sum of their metrics when flushed.
metrics.incrementCounter("Burgers sold")
metrics.incrementCounter("Burgers sold")

metrics.incrementCounter("Days without an incident", value=2)
metrics.decrementCounter("Days without an incident", value=2)

# Gauges track a single value. They send the most recent value
# when flushed.
metrics.recordGauge("Awesomeness", value=10)
metrics.recordGauge("Awesomeness", value=100)

# Timers record how long it takes a thing to happen.
# They send the min, max, mean, and count of their recorded values when flushed
with metrics.time("Do a slow thing"):
    time.sleep(5)


# periodically you should flush metrics
metrics.flush()

0.6 - 2018-05-31

Added documentation on Read the Docs.

Deprecated

  • FakeMetrics is now a list. Fakemetrics.metrics will be removed in 1.0 release.

0.5 - 2018-04-27

Breaking changes

  • Gauges no longer record min/mean/max/count Once we actually started using the library in anger, it became apparent that for most gauges, the min/max/mean params aren’t helpful.

    We’ve decided to drop that feature from recordGauge replacing it with a new recordSummary method. The time method has been rewritten to use a Summary rather than a Gauge.

  • Made the “counters”, and “gauges” properties of the Metrics class private.

  • Made the state of Counter, and Gauge private.

0.4 - 2017-11-14

Fixes

  • Fix issue where we get stuck always ‘Failed to flush metrics to riemann’

Deprecated

  • RiemannTransport.is_connected() should no longer be needed

[0.3.1]

Fixes

  • We now reconnect if there is an exception raised during flush

[0.3]

Fixes

  • Added missing TTL parameter to time method.

[0.2]

Fixes

  • TTL attributes are no longer coerced to strings

Indices and tables