blocks.meter

Instrumentation for block stores to measure data flows, call latencies, and other metrics.

The logic in this namespace is built around the notion of a metric event and an associated recording function on the store which the events are passed to. Each event has at least a namespaced :type keyword, a :label associated with the store, and a numeric :value.

Events may contain other information like the block id or method name as well, and it is up to the receiver to interpret them.

*io-report-period*

dynamic

Record incremental IO metrics every N seconds.

measure-method

(measure-method store method-kw attrs body-deferred)

Measure the end-to-end elapsed time for a block store method. Returns a deferred with a final report hook if the store has metering enabled.

measure-stream

(measure-stream store method-kw attrs stream)

Measure the flow of blocks through a manifold stream. Returns the wrapped stream, or the original if the store does not have metering enabled.

metered-block

(metered-block store metric-type block)

Wrap the block with a lazy constructor for a metered input stream which will report metrics for the given type. If the store does not have a recorder, the block will be returned unchanged.