cli-progress or cli-tui only.Expand description
Shared live-view metrics plumbing (recorder install + Prometheus-text
sampler), compiled when either live-view feature is on.
Shared live-metrics plumbing for faucet run — the in-process Prometheus
recorder installer plus a pure Prometheus-text parser/aggregator.
Both the full-screen TUI (--tui, cli-tui) and the lightweight inline
progress line (cli-progress) sample the same in-process Prometheus
recorder’s rendered text a few times a second (read-only — zero hot-path
impact) and reduce the handful of faucet_* series they care about into a
TuiModel per tick. Everything below the recorder installer is pure and
unit-tested; the render loops just call Sampler::observe with the
rendered text.
This module is compiled whenever either live-view feature is on, so the recorder + parser are shared rather than duplicated.
Structs§
- RowStats
- Live view of one matrix row / invocation.
- Sample
- One parsed sample line:
name{label="v",…} 1.5. - Sampler
- Turns successive Prometheus renders into
TuiModels, computing records/s from consecutive sink-records totals. - TuiModel
- The reduced model the renderers draw.
Functions§
- install_
metrics_ recorder - Install the Prometheus recorder for a live-view session and return its
render handle. When the config carries an
observability.prometheusblock the/metricsHTTP endpoint is preserved (recorder + listener, exactly whatinstall_observabilitywould have set up); otherwise a listener-less recorder is installed purely as the live view’s data source. Idempotent: a second call returns the first call’s handle. - parse_
samples - Parse the Prometheus text exposition format, skipping
# HELP/# TYPEcomments and lines that don’t parse (robustness over strictness — a live view must never crash on exporter output). - setup_
observability - Install a live-view session’s observability: the CLI owns the metrics
recorder (keeping the
/metricsendpoint when one is configured) so it can render the recorder’s output; the rest of the observability config (OTLP traces) installs as usual with the prometheus block taken out.