Striemann¶
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 newrecordSummary
method. Thetime
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.