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§
- Computed
Generic Gauge - A
Gauge
whose value is computed whenever it is observed. - Delete
OnDrop Metric - A
Metric
wrapper that deletes its labels from the vec when it is dropped. - Delete
OnDrop Wrapper - A wrapper for metrics to require delete on drop semantics
- Exec
Time Future - Future returned by
MetricsFutureExt::exec_time
. - Histogram
- A
Metric
counts individual observations from an event or sample stream in configurable buckets. Similar to aSummary
, it also provides a sum of observations and an observation count. - Make
Collector Opts - Options for MakeCollector. This struct should be instantiated using the metric macro.
- Metrics
Registry - The materialize metrics registry.
- Prometheus
Opts - A struct that bundles the options for creating most
Metric
types. - Unspecified
Metric - A type level flag used to ensure callers specify the kind of metric to record for
MetricsFutureExt
. - Wall
Time Future - Future returned by
MetricsFutureExt::wall_time
.
Traits§
- Duration
Metric 🔒 - 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. - Make
Collector - A wrapper for creating prometheus metrics more conveniently.
- Metric
VecExt - Extension trait for metrics vectors.
- Metric
Vec_ - A trait that allows being generic over
MetricVec
s. - Metrics
Future Ext - Exposes combinators that report metrics related to the execution of a
Future
to prometheus. - Prom
Labels Ext - An extension trait for types that are valid (or convertible into) prometheus labels:
slices/vectors of strings, and
BTreeMap
s.
Functions§
- register_
runtime_ metrics - Register the Tokio runtime’s metrics in our metrics registry.
Type Aliases§
- Computed
Gauge - A
ComputedGenericGauge
for 64-bit floating point numbers. - Computed
IntGauge - A
ComputedGenericGauge
for 64-bit signed integers. - ComputedU
IntGauge - A
ComputedGenericGauge
for 64-bit unsigned integers. - Counter
- A
Metric
represents a single numerical value that only ever goes up. - Counter
Vec - Delete-on-drop shadow of Prometheus prometheus::CounterVec.
- Delete
OnDrop Counter - A
GenericCounter
wrapper that deletes its labels from the vec when it is dropped. - Delete
OnDrop Gauge - A
GenericGauge
wrapper that deletes its labels from the vec when it is dropped. - Delete
OnDrop Histogram - A
Histogram
wrapper that deletes its labels from the vec when it is dropped. - Gauge
- Delete-on-drop shadow of Prometheus prometheus::Gauge.
- Gauge
Vec - Delete-on-drop shadow of Prometheus prometheus::GaugeVec.
- Histogram
Vec - 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). - IntCounter
Vec - Delete-on-drop shadow of Prometheus prometheus::IntCounterVec.
- IntGauge
- The integer version of
Gauge
. Provides better performance if metric values are all integers. - IntGauge
Vec - Delete-on-drop shadow of Prometheus prometheus::IntGaugeVec.
- UInt
Gauge - The unsigned integer version of
Gauge
. Provides better performance if metric values are all unsigned integers. - UInt
Gauge Vec - Delete-on-drop shadow of Prometheus raw::UIntGaugeVec.