riemann.folds

Functions for combining states.

Folds usually come in two variants: a friendly version like sum, and a strict version like sum*. Strict variants will throw when one of their events is nil, missing a metric, or otherwise invalid. In typical use, however, you won’t have all the necessary information to pass on an event. Friendly variants will do their best to ignore these error conditions where sensible, returning partially complete events or nil instead of throwing.

Called with an empty list, folds which would return a single event return nil.

quotient-sloppy

sorted-sample

(sorted-sample s points)

Sample a sequence of events at points. Returns events with service remapped to (str service “ ” point). For instance, (sorted-sample events [0 1]) returns a 2-element seq of the smallest event and the biggest event, by metric. The first has a service which ends in “ 0” and the second one ends in “ 1”. If the points is a map, eg (sorted-sample events {0 “.min” 1 “.max”}, the the values will be appened to the service name directly. Useful for extracting histograms and percentiles.

sorted-sample-extract

(sorted-sample-extract s points)

Returns the events in seqable s, sorted and taken at each point p of points, where p ranges from 0 (smallest metric) to 1 (largest metric). 0.5 is the median event, 0.95 is the 95th’ percentile event, and so forth. Ignores events without a metric.