pub struct TracesConfig {
pub enabled: bool,
pub sample_ratio: f64,
pub response_header: bool,
pub capture_headers: Vec<String>,
pub exclude_paths: Vec<String>,
}Expand description
Distributed traces: one span per request, children for the work inside it.
Fields§
§enabled: boolBuild spans at all. On (with [observability] enabled) even when no
exporter is configured, because the request id and the error fields a
span carries are worth having in the logs alone.
sample_ratio: f64Fraction of root requests recorded, 0.0–1.0. This is head
sampling — the decision is made before the request runs, so it cannot
prefer the ones that will fail. Keeping every failure and a fraction of
the rest is tail sampling, which is a Collector processor’s job, not
this server’s: sample everything here and decide there.
A sampled trace is sampled whole — a child never disagrees with its parent — and an
incoming traceparent decides for its own trace, so a request arriving
from an already-sampled caller is kept regardless of this number.
response_header: boolReturn the trace id to the caller as X-Trace-Id. What turns “it was
slow at 14:02” from a support ticket into a lookup.
capture_headers: Vec<String>Request headers to copy onto the span. Never include anything that
carries a credential — authorization and cookie are refused even if
they are listed here.
exclude_paths: Vec<String>Paths that are never traced, matched as prefixes after base_path.
Health checks and asset requests are noise that costs money per span.
Trait Implementations§
Source§impl Clone for TracesConfig
impl Clone for TracesConfig
Source§fn clone(&self) -> TracesConfig
fn clone(&self) -> TracesConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more