Available on crate feature metrics only.
Expand description

Metrics for materialize systems.

The idea here is that each subsystem keeps its metrics in a scoped-to-it struct, which gets registered (once) to the server’s (or a test’s) prometheus registry.

Instead of using prometheus’s (very verbose) metrics definitions, we rely on type inference to reduce the verbosity a little bit. A typical subsystem will look like the following:

#[derive(Debug, Clone)] // Note that prometheus metrics can safely be cloned
struct Metrics {
    pub bytes_sent: IntCounter,
}

impl Metrics {
    pub fn register_into(registry: &MetricsRegistry) -> Metrics {
        Metrics {
            bytes_sent: registry.register(metric!(
                name: "mz_pg_sent_bytes",
                help: "total number of bytes sent here",
            )),
        }
    }
}

Modules

Support for metrics that get removed from their corresponding metrics vector when dropped.
Access to non-delete-on-drop vector types

Structs

A Gauge whose value is computed whenever it is observed.
A GenericCounter wrapper that deletes its labels from the vec when it is dropped
A GenericGauge wrapper that deletes its labels from the vec when it is dropped
A GenericCounter wrapper that deletes its labels from the vec when it is dropped
A wrapper for metrics to require delete on drop semantics
A Metric counts individual observations from an event or sample stream in configurable buckets. Similar to a Summary, it also provides a sum of observations and an observation count.
The materialize metrics registry.
A struct that bundles the options for creating most Metric types.

Traits

Extension trait for all gauge metrics vectors.
Extension trait for all metrics vectors.
Extension trait for all gauge metrics vectors.
A wrapper for creating prometheus metrics more conveniently.
An extension trait for types that are valid (or convertible into) prometheus labels: slices/vectors of strings, and HashMaps.

Type Definitions

A ComputedGenericGauge for 64-bit floating point numbers.
A ComputedGenericGauge for 64-bit signed integers.
A ComputedGenericGauge for 64-bit unsigned integers.
A Metric represents a single numerical value that only ever goes up.
Delete-on-drop shadow of Prometheus prometheus::CounterVec.
Delete-on-drop shadow of Prometheus prometheus::Gauge.
Delete-on-drop shadow of Prometheus prometheus::HistogramVec.
The integer version of Counter. Provides better performance if metric values are all positive integers (natural numbers).
Delete-on-drop shadow of Prometheus prometheus::IntCounterVec.
The integer version of Gauge. Provides better performance if metric values are all integers.
Delete-on-drop shadow of Prometheus prometheus::IntGaugeVec.
The unsigned integer version of Gauge. Provides better performance if metric values are all unsigned integers.
Delete-on-drop shadow of Prometheus raw::UIntGaugeVec.