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.
(count events)
Returns the number of events.
Returns the number of events.
(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.
(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.
(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.
(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.
(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.
(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.
(maximum events)
Returns the maximum event, by metric.
Returns the maximum event, by metric.
(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.
(median events)
Returns the median event from events, by metric.
Returns the median event from events, by metric.
(minimum events)
Returns the minimum event, by metric.
Returns the minimum event, by metric.
(mode events)
Yield any mode returned by modes.
Yield any mode returned by modes.
(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.
(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.
(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.
(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.
(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.
(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.
(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.
(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.
(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.
(std-dev events)
calculates standard deviation across a seq of events
calculates standard deviation across a seq of events
(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.
(sum* events)
Adds events together. Sums metrics, merges into first of events.
Adds events together. Sums metrics, merges into first of events.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close