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
Metric
wrapper that deletes its labels from the vec when it is dropped. - A wrapper for metrics to require delete on drop semantics
- Future returned by
MetricsFutureExt::exec_time
. - Options for MakeCollector. This struct should be instantiated using the metric macro.
- The materialize metrics registry.
- A struct that bundles the options for creating most
Metric
types. - A type level flag used to ensure callers specify the kind of metric to record for
MetricsFutureExt
. - Future returned by
MetricsFutureExt::wall_time
.
Traits§
- 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 likeWallTimeFuture
andExecTimeFuture
over different kinds of prometheus metrics. - A wrapper for creating prometheus metrics more conveniently.
- Extension trait for metrics vectors.
- A trait that allows being generic over
MetricVec
s. - 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
BTreeMap
s.
Type Aliases§
- 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.
- 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
Histogram
wrapper that deletes its labels from the vec when it is dropped. - Delete-on-drop shadow of Prometheus prometheus::Gauge.
- Delete-on-drop shadow of Prometheus prometheus::CounterVec.
- 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.