Liking cljdoc? Tell your friends :D

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.

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.
raw docstring

adjust-occurenceclj

(adjust-occurence state {:keys [metric] :as event})
source

countclj

(count events)

Returns the number of events.

Returns the number of events.
sourceraw docstring

differenceclj

(difference events)

Subtracts events. Returns the first event, with its metric reduced by the metrics of all subsequent events with metrics. Returns nil if the first event is nil, or its metric is nil.

Subtracts events. Returns the first event, with its metric reduced by the
metrics of all subsequent events with metrics. Returns nil if the first event
is nil, or its metric is nil.
sourceraw docstring

difference*clj

(difference* events)

Subtracts events. Returns the first event, with its metric reduced by the metrics of all subsequent events.

Subtracts events. Returns the first event, with its metric reduced by the
metrics of all subsequent events.
sourceraw docstring

extremumclj

(extremum comparison events)

Returns an extreme event, by a comparison function over the metric.

Returns an extreme event, by a comparison function over the metric.
sourceraw docstring

foldclj

(fold f events)

Fold with a reduction function over metrics. Ignores nil events and events with nil metrics.

If there are no non-nil events, returns nil.

Fold with a reduction function over metrics. Ignores nil events and events
with nil metrics.

If there are *no* non-nil events, returns nil.
sourceraw docstring

fold*clj

(fold* f events)

Fold with a reduction function over metrics. Throws if any event or metric is nil.

Fold with a reduction function over metrics. Throws if any event or metric
is nil.
sourceraw docstring

fold-allclj

(fold-all f events)

Fold with a reduction function over metrics.

If the first event has a nil :metric, or if any remaining event is nil, or has a nil metric, returns the first event, but with :metric nil and a :description of the error.

If the first event is nil, returns nil.

Fold with a reduction function over metrics.

If the first event has a nil :metric, or if any remaining event is nil, or
has a nil metric, returns the first event, but with :metric nil and a
:description of the error.

If the first event is nil, returns nil.
sourceraw docstring

maximumclj

(maximum events)

Returns the maximum event, by metric.

Returns the maximum event, by metric.
sourceraw docstring

meanclj

(mean events)

Averages events together. Mean metric, merged into first of events. Ignores nil events and nil metrics.

Averages events together. Mean metric, merged into first of events. Ignores
nil events and nil metrics.
sourceraw docstring

medianclj

(median events)

Returns the median event from events, by metric.

Returns the median event from events, by metric.
sourceraw docstring

minimumclj

(minimum events)

Returns the minimum event, by metric.

Returns the minimum event, by metric.
sourceraw docstring

modeclj

(mode events)

Yield any mode returned by modes.

Yield any mode returned by modes.
sourceraw docstring

modesclj

(modes events)

Keep track of repeating metrics. Yields a sequence of events with the highest occuring metrics.

Keep track of repeating metrics. Yields a sequence of events with the highest
occuring metrics.
sourceraw docstring

non-nil-metricsclj

(non-nil-metrics events)

Given a sequence of events, returns a compact sequence of their metrics--that is, omits any events which are nil, or have nil metrics.

Given a sequence of events, returns a compact sequence of their
metrics--that is, omits any events which are nil, or have nil metrics.
sourceraw docstring

productclj

(product events)

Multiplies events. Returns the first event with a metric, with its metric being the product of all events with metrics.

Multiplies events. Returns the first event with a metric, with its metric
being the product of all events with metrics.
sourceraw docstring

product*clj

(product* events)

Multiplies events. Returns the first event, with its metric multiplied by the metrics of all other events.

Multiplies events. Returns the first event, with its metric multiplied by
the metrics of all other events.
sourceraw docstring

quotientclj

(quotient events)

Divides events. Returns the first event, with its metric divided by the product of the metrics of all subsequent events.

Divides events. Returns the first event, with its metric divided by the
product of the metrics of all subsequent events.
sourceraw docstring

quotient*clj

(quotient* events)

Divides events. Returns the first event, with its metric divided by the product of the metrics of all subsequent events. Like quotient, but throws when any metric is nil or a divisor is zero.

Divides events. Returns the first event, with its metric divided by the
product of the metrics of all subsequent events. Like quotient, but throws
when any metric is nil or a divisor is zero.
sourceraw docstring

quotient-sloppyclj

(quotient-sloppy events)

Like quotient, but considers 0/0 = 0. Useful for relative rates, when you want the ratio of two constant values to be zero.

Like quotient, but considers 0/0 = 0. Useful for relative rates, when you
want the ratio of two constant values to be zero.
sourceraw docstring

sorted-sampleclj

(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.

When s is empty, returns an empty list.

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.

When s is empty, returns an empty list.
sourceraw docstring

sorted-sample-extractclj

(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.

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.
sourceraw docstring

std-devclj

(std-dev events)

calculates standard deviation across a seq of events

calculates standard deviation across a seq of events
sourceraw docstring

sumclj

(sum events)

Adds events together. Sums metrics, merges into first event with a metric, ignores nil events and nil metrics.

Adds events together. Sums metrics, merges into first event with a metric,
ignores nil events and nil metrics.
sourceraw docstring

sum*clj

(sum* events)

Adds events together. Sums metrics, merges into first of events.

Adds events together. Sums metrics, merges into first of events.
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close