Module dipstick::core [] [src]

Dipstick metrics core types and traits. This is mostly centered around the backend. Application-facing types are in the app module.

Structs

Chain

A pair of functions composing a twin "chain of command". This is the building block for the metrics backend.

ControlScopeFn

Returns a callback function to send commands to the metric scope. Writes can be performed by passing Some((&Metric, Value)) Flushes can be performed by passing None Used to write values to the scope or flush the scope buffer (if applicable). Simple applications may use only one scope. Complex applications may define a new scope fo each operation or request. Scopes can be moved acrossed threads (Send) but are not required to be thread-safe (Sync). Some implementations may be 'Sync', otherwise queue()ing or threadlocal() can be used.

ScopeCounter

A counter that sends values to the metrics backend

ScopeGauge

A gauge that sends values to the metrics backend

ScopeMarker

A monotonic counter metric. Since value is only ever increased by one, no value parameter is provided, preventing programming errors.

ScopeTimer

A timer that sends values to the metrics backend Timers can record time intervals in multiple ways : - with the time! macro which wraps an expression or block with start() and stop() calls. - with the time(Fn) method which wraps a closure with start() and stop() calls. - with start() and stop() methods wrapping around the operation to time - with the interval_us() method, providing an externally determined microsecond interval

TimeHandle

A handle to the start time of a counter. Wrapped so it may be changed safely later.

Enums

Kind

Used to differentiate between metric kinds in the backend.

ScopeCmd

An method dispatching command enum to manipulate metric scopes. Replaces a potential Writer trait that would have methods write and flush. Using a command pattern allows buffering, async queuing and inline definition of writers.

Constants

FULL_SAMPLING_RATE

Do not sample, use all data.

Traits

ToPrimitive

A generic trait for converting a value to a number.

Type Definitions

DefineMetricFn

Dynamic metric definition function. Metrics can be defined from any thread, concurrently (Fn is Sync). The resulting metrics themselves can be also be safely shared across threads ( is Send + Sync). Concurrent usage of a metric is done using threaded scopes. Shared concurrent scopes may be provided by some backends (aggregate).

OpenScopeFn

A function trait that opens a new metric capture scope.

Rate

Base type for sampling rate. - 1.0 records everything - 0.5 records one of two values - 0.0 records nothing The actual distribution (random, fixed-cycled, etc) depends on selected sampling method.

Value

Base type for recorded metric values.