Crate dipstick [] [src]

A quick, modular metrics toolkit for Rust applications.

Re-exports

pub use core::*;

Modules

core

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

error

Error-chain like mechanism, without the error-chain dependency.

macros

Publicly exposed metric macros are defined here. Although dipstick does not have a macro-based API, in some situations they can make instrumented code simpler.

Macros

app_counter

Define application-scoped counters.

app_gauge

Define application-scoped gauges.

app_marker

Define application-scoped markers.

app_metrics

Define application-scoped metrics.

app_timer

Define application-scoped timers.

mod_counter

Define module-scoped counters.

mod_gauge

Define module-scoped gauges.

mod_marker

Define module-scoped markers.

mod_metrics

Define module-scoped metrics.

mod_timer

Define module-scoped timers.

time

A convenience macro to wrap a block or an expression with a start / stop timer. Elapsed time is sent to the supplied statsd client after the computation has been performed. Expression result (if any) is transparently returned.

Structs

Aggregator

Central aggregation structure. Since AggregateKeys themselves contain scores, the aggregator simply maintains a shared list of metrics for enumeration when used as source.

AppCounter

A counter that sends values to the metrics backend

AppGauge

A gauge that sends values to the metrics backend

AppMarker

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

AppMetrics

Variations of this should also provide control of the metric recording scope.

AppTimer

A timer that sends values to the metrics backend Timers can record time intervals in multiple ways :

CancelHandle

A handle to cancel a scheduled task if required.

Graphite

Key of a graphite metric.

Namespace

A list of parts of a metric's name.

Publisher

Define and write metrics from aggregated scores to the target channel If this is called repeatedly it can be a good idea to use the metric cache to prevent new metrics from being created every time.

QueueCommand

Carry the scope command over the queue, from the sender, to be executed by the receiver.

RetrySocket

A socket that retries

Scoreboard

A metric that holds aggregated values. Some fields are kept public to ease publishing.

Statsd

Key of a statsd metric.

Enums

ScoreType

Possibly aggregated scores.

Traits

Publish

A trait to publish metrics.

ToPrimitive

A generic trait for converting a value to a number.

ToSocketAddrs

A trait for objects which can be converted or resolved to one or more SocketAddr values.

WithAsyncQueue

Enqueue collected metrics for dispatch on background thread.

WithCache

Cache metrics to prevent them from being re-defined on every use. Use of this should be transparent, this has no effect on the values. Stateful sinks (i.e. Aggregate) may naturally cache their definitions.

WithNamespace

Prepend metric names with custom prefix.

WithSamplingRate

Apply statistical sampling to collected metrics data.

Functions

aggregate

Aggregate metrics in memory. Depending on the type of metric, count, sum, minimum and maximum of values will be tracked. Needs to be connected to a publish to be useful.

all_stats

A predefined export strategy reporting all aggregated stats for all metric types. Resulting stats are named by appending a short suffix to each metric's name.

app_metrics

Wrap the metrics backend to provide an application-friendly interface. Open a metric scope to share across the application.

async [
Deprecated
]

Enqueue collected metrics for dispatch on background thread.

average

A predefined export strategy reporting the average value for every non-marker metric. Marker metrics export their hit count instead. Since there is only one stat per metric, there is no risk of collision and so exported stats copy their metric's name.

cache [
Deprecated
]

Cache metrics to prevent them from being re-defined on every use. Use of this should be transparent, this has no effect on the values. Stateful sinks (i.e. Aggregate) may naturally cache their definitions.

metrics [
Deprecated
]

Wrap the metrics backend to provide an application-friendly interface. Open a metric scope to share across the application.

prefix [
Deprecated
]

deprecated, use with_prefix() omitting any previously supplied separator

sample [
Deprecated
]

Perform random sampling of values according to the specified rate.

schedule

Schedule a task to run periodically. Starts a new thread for every task.

snapshot

Capture a snapshot of Dipstick's internal metrics since the last snapshot.

summary

A predefined single-stat-per-metric export strategy:

to_graphite

Send metrics to a graphite server at the address and port provided.

to_log

Write metric values to the standard log using info!.

to_statsd

Send metrics to a statsd server at the address and port provided.

to_stdout

Write metric values to stdout using println!.

to_void

Discard all metric values sent to it.

Type Definitions

Aggregate

The type of metric created by the Aggregator.

ScoreSnapshot

A snapshot of multiple scores for a single metric.