Module mz_ore::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§

  • Access to non-delete-on-drop vector types

Structs§

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.
  • Exposes combinators that report metrics related to the execution of a Future to prometheus.
  • An extension trait for types that are valid (or convertible into) prometheus labels: slices/vectors of strings, and BTreeMaps.

Type Aliases§