Skip to main content

Module observability

Module observability 

Source
Expand description

Metrics, tracing and the OpenAPI document, built from configuration.

The three share a shape: off unless configured on, each reading one section of config/. Nothing here decides for the application; it reads what the application decided and builds it.

ⓘ
// config/metrics.rs
config.set(keys::METRICS_ENABLED, env.bool("METRICS_ENABLED", false))?;
config.set(keys::METRICS_PATH, env.string("METRICS_PATH", "/metrics"))?;

§Why off by default

Each costs something a request pays for — a lock and a timer, a span, a document rendered at boot — and more importantly each exposes something. A metrics endpoint tells a reader your traffic shape and every route you serve; an OpenAPI document is a map of your API. Both are things to turn on deliberately, on a path you have thought about.

Structs§

MetricsSettings
What the configuration says about metrics.
OpenApiSettings
What the configuration says about the OpenAPI document.
TelemetrySettings
What the configuration says about tracing.

Functions§

metrics_endpoint
GET /metrics — the scrape endpoint, reading the bound registry.
openapi_endpoint
GET /openapi.json — the document, reading what boot rendered.
settings
Read all three, for a boot that wants to report what it turned on.