Function mz_persist_client::cache::consensus_rtt_latency_task
source · async fn consensus_rtt_latency_task(
consensus: Arc<Tasked<MetricsConsensus>>,
metrics: Arc<Metrics>,
measurement_interval: Duration,
) -> JoinHandle<()>
Expand description
Starts a task to periodically measure the persist-observed latency to consensus.
This is a task, rather than something like looking at the latencies of prod traffic, so that we minimize any issues around Futures not being polled promptly (as can and does happen with the Timely-polled Futures).
The caller is responsible for shutdown via aborting the JoinHandle
.
No matter whether we wrap MetricsConsensus before or after we start up the rtt latency task, there’s the possibility for it being confusing at some point. Err on the side of more data (including the latency measurements) to start.