Module metrics

Source
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§

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

Structs§

ComputedGenericGauge
A Gauge whose value is computed whenever it is observed.
DeleteOnDropMetric
A Metric wrapper that deletes its labels from the vec when it is dropped.
DeleteOnDropWrapper
A wrapper for metrics to require delete on drop semantics
ExecTimeFuture
Future returned by MetricsFutureExt::exec_time.
Histogram
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.
MakeCollectorOpts
Options for MakeCollector. This struct should be instantiated using the metric macro.
MetricsRegistry
The materialize metrics registry.
PrometheusOpts
A struct that bundles the options for creating most Metric types.
UnspecifiedMetric
A type level flag used to ensure callers specify the kind of metric to record for MetricsFutureExt.
WallTimeFuture
Future returned by MetricsFutureExt::wall_time.

Traits§

DurationMetric 🔒
A trait makes recording a duration generic over different prometheus metrics. This allows us to de-dupe the implemenation of Future for our wrapper Futures like WallTimeFuture and ExecTimeFuture over different kinds of prometheus metrics.
MakeCollector
A wrapper for creating prometheus metrics more conveniently.
MetricVecExt
Extension trait for metrics vectors.
MetricVec_
A trait that allows being generic over MetricVecs.
MetricsFutureExt
Exposes combinators that report metrics related to the execution of a Future to prometheus.
PromLabelsExt
An extension trait for types that are valid (or convertible into) prometheus labels: slices/vectors of strings, and BTreeMaps.

Functions§

register_runtime_metrics
Register the Tokio runtime’s metrics in our metrics registry.

Type Aliases§

ComputedGauge
A ComputedGenericGauge for 64-bit floating point numbers.
ComputedIntGauge
A ComputedGenericGauge for 64-bit signed integers.
ComputedUIntGauge
A ComputedGenericGauge for 64-bit unsigned integers.
Counter
A Metric represents a single numerical value that only ever goes up.
CounterVec
Delete-on-drop shadow of Prometheus prometheus::CounterVec.
DeleteOnDropCounter
A GenericCounter wrapper that deletes its labels from the vec when it is dropped.
DeleteOnDropGauge
A GenericGauge wrapper that deletes its labels from the vec when it is dropped.
DeleteOnDropHistogram
A Histogram wrapper that deletes its labels from the vec when it is dropped.
Gauge
Delete-on-drop shadow of Prometheus prometheus::Gauge.
GaugeVec
Delete-on-drop shadow of Prometheus prometheus::GaugeVec.
HistogramVec
Delete-on-drop shadow of Prometheus prometheus::HistogramVec.
IntCounter
The integer version of Counter. Provides better performance if metric values are all positive integers (natural numbers).
IntCounterVec
Delete-on-drop shadow of Prometheus prometheus::IntCounterVec.
IntGauge
The integer version of Gauge. Provides better performance if metric values are all integers.
IntGaugeVec
Delete-on-drop shadow of Prometheus prometheus::IntGaugeVec.
UIntGauge
The unsigned integer version of Gauge. Provides better performance if metric values are all unsigned integers.
UIntGaugeVec
Delete-on-drop shadow of Prometheus raw::UIntGaugeVec.