pd::metrics

Module sleep_worker

Source
Expand description

A sleep worker.

§Overview

This submodule defines a metric, and an accompanying worker task, for use in measuring scheduler latency in the tokio runtime. This worker will repeatedly sleep for one second, and then observe the amount of time it actually spent waiting to be woken up. This is useful for detecting when the asynchronous runtime is being disrupted by blocking I/O, or other expensive non-coöperative computation.

Use register_metrics() to register the SLEEP_DRIFT metric with an exporter, and spawn the worker onto a runtime by calling run().

Constants§

Functions§