pub struct MetricsConfig {
pub enabled: bool,
pub path: String,
}Expand description
Prometheus metrics endpoint ([metrics] block).
Disabled by default. When enabled = true (and the binary was built
with the metrics cargo feature), the server installs a middleware
that records per-request HTTP counters and latency histograms, and
exposes them in the Prometheus text exposition format at
MetricsConfig::path (default /metrics).
The endpoint is mounted at a fixed, unprefixed path — like the
health probes — so a scrape config doesn’t need to know about any
reverse-proxy server.prefix. It is not behind the [auth]
layer: Prometheus scrapers rarely carry bearer tokens, and the
endpoint exposes only aggregate request metrics (no row data). Keep
it on a network the scraper can reach but the public cannot, e.g. by
binding server.listen to a private interface.
When the binary was built without the metrics feature,
enabled = true is harmless: the server logs a warning at startup
and skips the endpoint.
Fields§
§enabled: bool§path: StringTrait Implementations§
Source§impl Clone for MetricsConfig
impl Clone for MetricsConfig
Source§fn clone(&self) -> MetricsConfig
fn clone(&self) -> MetricsConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more